(WRITTEN_BY): Rename from AUTHORS.
[platform/upstream/coreutils.git] / src / pwd.c
index 3642c9b..1c0a037 100644 (file)
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -1,5 +1,5 @@
 /* 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;
@@ -45,13 +43,13 @@ usage (int status)
   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);
 }
@@ -61,6 +59,7 @@ main (int argc, char **argv)
 {
   char *wd;
 
+  initialize_main (&argc, &argv);
   program_name = argv[0];
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
@@ -69,15 +68,15 @@ main (int argc, char **argv)
   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);
 }