/* pwd - print current directory
- Copyright (C) 1994-1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1994-1997, 1999-2003 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
#include <sys/types.h>
#include "system.h"
-#include "closeout.h"
#include "long-options.h"
#include "error.h"
+#include "xgetcwd.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "pwd"
-#define AUTHORS "Jim Meyering"
-
-char *xgetcwd ();
+#define WRITTEN_BY _("Written by Jim Meyering.")
/* The name this program was run with. */
char *program_name;
else
{
printf (_("Usage: %s [OPTION]\n"), program_name);
- printf (_("\
+ fputs (_("\
Print the full filename of the current working directory.\n\
\n\
- --help display this help and exit\n\
- --version output version information and exit\n\
-"));
- puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
+"), stdout);
+ fputs (HELP_OPTION_DESCRIPTION, stdout);
+ fputs (VERSION_OPTION_DESCRIPTION, stdout);
+ printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
{
char *wd;
+ initialize_main (&argc, &argv);
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
+ WRITTEN_BY, usage);
- if (argc != 1)
+ if (1 < argc)
error (0, 0, _("ignoring non-option arguments"));
wd = xgetcwd ();
if (wd == NULL)
- error (1, errno, _("cannot get current directory"));
+ error (EXIT_FAILURE, errno, _("cannot get current directory"));
printf ("%s\n", wd);
- exit (0);
+ exit (EXIT_SUCCESS);
}