/* printenv -- print all or part of environment
- Copyright (C) 1989-1997, 1999-2003 Free Software Foundation, Inc.
+ Copyright (C) 1989-1997, 1999-2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Exit status:
0 if all variables specified were found
1 if not
+ 2 if some other error occurred
David MacKenzie and Richard Mlynarik */
#include "system.h"
#include "error.h"
-#include "exitfail.h"
#include "long-options.h"
+/* Exit status for syntax errors, etc. */
+enum { PRINTENV_FAILURE = 2 };
+
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "printenv"
void
usage (int status)
{
- if (status != 0)
+ if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- exit_failure = 2;
+ initialize_exit_failure (PRINTENV_FAILURE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
break;
default:
- usage (EXIT_FAILURE);
+ usage (PRINTENV_FAILURE);
}
}
{
for (env = environ; *env != NULL; ++env)
puts (*env);
- exit_status = 0;
+ exit_status = EXIT_SUCCESS;
}
else
{