Sophie

Sophie

distrib > Altlinux > 4.1 > i586 > by-pkgid > fe5208a8ce4497847ee20f8f2a41e486 > files > 6

ed-0.2-alt7.src.rpm

--- ed-0.2/main.c.orig	2002-08-26 13:56:44 +0400
+++ ed-0.2/main.c	2002-08-26 13:57:43 +0400
@@ -105,7 +105,6 @@
 long err_status = 0;		/* program exit status */
 
 /* The name this program was run with. */
-char *program_name;
 
 /* If non-zero, display usage information and exit.  */
 int show_help = 0;
@@ -136,10 +135,10 @@
      int status;
 {
   if (status != 0)
-    fprintf (stderr, "Try `%s --help' for more information.\n", program_name);
+    fprintf (stderr, "Try `%s --help' for more information.\n", program_invocation_short_name);
   else
     {
-      printf ("Usage: %s [OPTION]... [FILE]\n", program_name);
+      printf ("Usage: %s [OPTION]... [FILE]\n", program_invocation_short_name);
       printf ("\
 \n\
   -G, --traditional          use a few backward compatible features\n\
@@ -165,7 +164,9 @@
   int c, n;
   long status = 0;
 
-  program_name = argv[0];
+  if (argc < 1)
+    usage (1);
+
   red = (n = strlen (argv[0])) > 2 && argv[0][n - 3] == 'r';
 top:
   while ((c = getopt_long (argc, argv, "Gp:s", long_options, NULL)) != EOF)