about summary refs log tree commit diff
path: root/elf/sln.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-06 20:13:07 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-06 20:13:07 +0000
commitcbbcaf2369b2111d9388ce54ea18854319dbfab3 (patch)
tree0ffc9cafd19065f44923eee2d1e6fac3afb114d4 /elf/sln.c
parente2e390fad8271da33a51075cc2bf27c9fe78861b (diff)
downloadglibc-cbbcaf2369b2111d9388ce54ea18854319dbfab3.tar.gz
glibc-cbbcaf2369b2111d9388ce54ea18854319dbfab3.tar.xz
glibc-cbbcaf2369b2111d9388ce54ea18854319dbfab3.zip
* debug/xtrace.sh: Unify translatable messages.
	* elf/ldd.bash.in: Likewise.
	* elf/sprof.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* malloc/memusage.sh: Likewise.
	* nss/getent.c: Likewise.

2009-02-06  Joseph Myers  <joseph@codesourcery.com>

	* debug/pcprofiledump.c (print_version,
	argp_program_version_hook): New function.
	* elf/ldconfig.c (more_help): New function.
	(argp): Use it.
	* elf/sln.c (usage): New function.
	(main): Support --help and --version.
	* malloc/memusagestat.c (print_version): New function.
	(argp_program_version_hook): New variable.
	* nscd/nscd.c (more_help): New function.
	(argp): Use it.
	* posix/getconf.c (main): Send --version output to stdout.
	Support --help.
	* sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS
	arguments.  All callers changed.
	(print_version): New function.
	(parseargs): Support --help and --version.
	* sunrpc/rpcinfo.c (usage): Take STREAM argument.  All callers
	changed.
	(print_version): New function.
	(main): Use getopt_long.  Support --help and --version.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and
	--version.

2009-02-06  Ulrich Drepper  <drepper@redhat.com>
Diffstat (limited to 'elf/sln.c')
-rw-r--r--elf/sln.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/elf/sln.c b/elf/sln.c
index 8e66510bb2..a8210c1fc0 100644
--- a/elf/sln.c
+++ b/elf/sln.c
@@ -1,5 +1,5 @@
 /* `sln' program to create symbolic links between files.
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,9 +16,15 @@
    License along with the GNU C Library; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
-
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <error.h>
 #include <errno.h>
+#include <libintl.h>
+#include <locale.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -28,19 +34,37 @@
 #include <string.h>
 #include <limits.h>
 
+#include "../version.h"
+
+#define PACKAGE _libc_intl_domainname
+
 #if !defined S_ISDIR && defined S_IFDIR
 #define	S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
 #endif
 
 static int makesymlink (const char *src, const char *dest);
 static int makesymlinks (const char *file);
+static void usage (void);
 
 int
 main (int argc, char **argv)
 {
+  /* Set locale via LC_ALL.  */
+  setlocale (LC_ALL, "");
+
+  /* Set the text message domain.  */
+  textdomain (PACKAGE);
+
   switch (argc)
     {
     case 2:
+      if (strcmp (argv[1], "--version") == 0) {
+	printf ("sln (GNU libc) %s\n", VERSION);
+	return 0;
+      } else if (strcmp (argv[1], "--help") == 0) {
+	usage ();
+	return 0;
+      }
       return makesymlinks (argv [1]);
       break;
 
@@ -49,12 +73,20 @@ main (int argc, char **argv)
       break;
 
     default:
-      printf ("Usage: %s src dest|file\n", argv [0]);
+      usage ();
       return 1;
       break;
     }
 }
 
+static void
+usage (void)
+{
+  printf (_("Usage: sln src dest|file\n\n"));
+  printf (_("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"));
+}
+
 static int
 makesymlinks (file)
      const char *file;
@@ -75,7 +107,7 @@ makesymlinks (file)
       fp = fopen (file, "r");
       if (fp == NULL)
 	{
-	  fprintf (stderr, "%s: file open error: %m\n", file);
+	  fprintf (stderr, _("%s: file open error: %m\n"), file);
 	  return 1;
 	}
     }
@@ -112,7 +144,7 @@ makesymlinks (file)
 	++cp;
       if (*cp == '\0')
 	{
-	  fprintf (stderr, "No target in line %d\n", lineno);
+	  fprintf (stderr, _("No target in line %d\n"), lineno);
 	  ret = 1;
 	  continue;
 	}
@@ -144,13 +176,13 @@ makesymlink (src, dest)
     {
       if (S_ISDIR (stats.st_mode))
 	{
-	  fprintf (stderr, "%s: destination must not be a directory\n",
+	  fprintf (stderr, _("%s: destination must not be a directory\n"),
 	  	   dest);
 	  return 1;
 	}
       else if (unlink (dest) && errno != ENOENT)
 	{
-	  fprintf (stderr, "%s: failed to remove the old destination\n",
+	  fprintf (stderr, _("%s: failed to remove the old destination\n"),
 	  	   dest);
 	  return 1;
 	}
@@ -158,7 +190,7 @@ makesymlink (src, dest)
   else if (errno != ENOENT)
     {
       error = strerror (errno);
-      fprintf (stderr, "%s: invalid destination: %s\n", dest, error);
+      fprintf (stderr, _("%s: invalid destination: %s\n"), dest, error);
       return -1;
     }
 
@@ -173,7 +205,7 @@ makesymlink (src, dest)
         {
 	  error = strerror (errno);
 	  unlink (dest);
-	  fprintf (stderr, "Invalid link from \"%s\" to \"%s\": %s\n",
+	  fprintf (stderr, _("Invalid link from \"%s\" to \"%s\": %s\n"),
 	  	   src, dest, error);
 	  return 1;
 	}
@@ -182,7 +214,7 @@ makesymlink (src, dest)
   else
     {
       error = strerror (errno);
-      fprintf (stderr, "Invalid link from \"%s\" to \"%s\": %s\n",
+      fprintf (stderr, _("Invalid link from \"%s\" to \"%s\": %s\n"),
       	       src, dest, error);
       return 1;
     }