]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
merge with 1.8.1h
authorJim Meyering <jim@meyering.net>
Sun, 24 Oct 1993 21:30:08 +0000 (21:30 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 24 Oct 1993 21:30:08 +0000 (21:30 +0000)
22 files changed:
lib/getusershell.c
lib/putenv.c
old/sh-utils/ChangeLog
src/basename.c
src/date.c
src/dirname.c
src/echo.c
src/env.c
src/expr.c
src/id.c
src/logname.c
src/nice.c
src/pathchk.c
src/printf.c
src/sleep.c
src/stty.c
src/su.c
src/tee.c
src/test.c
src/tty.c
src/uname.c
src/who.c

index 2607535f23ba39e98ac0a9b9e1d1283ee75e9fe0..9eb2520b0df61b46ba4ca7b848827dce80327ef4 100644 (file)
@@ -43,6 +43,8 @@ char *malloc ();
 char *realloc ();
 #endif
 
+char *xstrdup ();
+
 static int readname ();
 
 /* List of shells to use if the shells file is missing. */
@@ -65,6 +67,8 @@ static char *line = NULL;
 static int line_size = 0;
 \f
 /* Return an entry from the shells file, ignoring comment lines.
+   If the file doesn't exist, use the list in DEFAULT_SHELLS (above).
+   In any case, the returned string is in memory allocated through malloc.
    Return NULL if there are no more entries.  */
 
 char *
@@ -74,7 +78,7 @@ getusershell ()
     {
       if (default_shells[default_index])
        /* Not at the end of the list yet.  */
-       return default_shells[default_index++];
+       return xstrdup (default_shells[default_index++]);
       return NULL;
     }
 
@@ -85,7 +89,7 @@ getusershell ()
        {
          /* No shells file.  Use the default list.  */
          default_index = 1;
-         return default_shells[0];
+         return xstrdup (default_shells[0]);
        }
     }
 
index 573e62478bd1caeb0ab36a2826bf673395b2b06f..47f7256e581ef1f012c256e29824ce87bcd05259 100644 (file)
@@ -36,6 +36,8 @@ Cambridge, MA 02139, USA.  */
 /* Don't include stdlib.h for non-GNU C libraries because some of them
    contain conflicting prototypes for getopt.  */
 #include <stdlib.h>
+#else
+char *malloc ();
 #endif /* GNU C library.  */
 
 #ifndef STDC_HEADERS
@@ -104,7 +106,8 @@ putenv (string)
       char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
       if (new_environ == NULL)
        return -1;
-      (void) bcopy ((char *) environ, (char *) new_environ, size * sizeof (char *));
+      (void) bcopy ((char *) environ, (char *) new_environ,
+                   size * sizeof (char *));
       new_environ[size] = (char *) string;
       new_environ[size + 1] = NULL;
       if (last_environ != NULL)
index 4a635002b592f8e90cfc5cc483b90f1e3a92444e..4ba295151afd9f5e6c43b7f7e85cf8fc2278f57e 100644 (file)
@@ -1,3 +1,16 @@
+Sun Oct 24 14:10:23 1993  Jim Meyering  (meyering@comco.com)
+
+       * long-options.c: Save and restore optind, too.
+       * long-options.h: New file.
+       * long-options.c, echo.c, expr.c, printf.c, test.c, yes.c:
+       Include it instead of duplicating dcls.
+       * src/Makefile.in: Add dependencies for it.
+
+Tue Oct 19 00:26:27 1993  Jim Meyering  (meyering@comco.com)
+
+       * expr.c [!__STDC__]: Don't define away `const'.  configure alone
+       decides whether to do that.  From Francois Pinard.
+
 Sat Oct 16 22:32:54 1993  Jim Meyering  (meyering@comco.com)
 
        * whoami.c (main): Cast printf arg UID so it matches the type
index 167b502d34425c0f0ffcf035eae855cf179adc50..6c8e7fe55a550a5c051266177c9587f9457a23ed 100644 (file)
@@ -74,7 +74,7 @@ Usage: %s [OPTION]... PATH [SUFFIX]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 2bb28cdbca5384281802c86eeacfc83065d7c9b8..9e5605ca7f9e1ade67f7d960fb55034c52ddea1e 100644 (file)
@@ -230,7 +230,7 @@ Usage: %s [OPTION]... [+FORMAT] [MMDDhhmm[[CC]YY][.ss]]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
     {
index 0aebb97939fe4488fbdc94b05a6b9ebaa89964a0..a40c8267d6c9a800163773e14e443ac66195f5a8 100644 (file)
@@ -63,7 +63,7 @@ Usage: %s [OPTION]... PATH\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 6c514fc8c42717399abc8aed6451350c7655de2b..4a2f673de98593b363639f176c9d2b3545246e20 100644 (file)
@@ -31,6 +31,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <sys/types.h>
 #include "system.h"
+#include "long-options.h"
 
 /* echo [-neE] [arg ...]
 Output the ARGs.  If -n is specified, the trailing newline is
@@ -71,8 +72,6 @@ on System V systems with the -E option.
 /* The name this program was run with. */
 char *program_name;
 
-void parse_long_options ();
-
 static void
 usage (status)
      int status;
@@ -83,7 +82,7 @@ Usage: %s [OPTION]... [STRING]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 2f448c7b1f943e054d1cee1c5ef721e9e423a9f0..2fb0d7ec98529ec9373cdfc96310b482a32b7271 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -201,7 +201,7 @@ Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
@@ -209,8 +209,8 @@ Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n\
 \n\
   -u, --unset NAME           remove variable from the environment\n\
   -i, --ignore-environment   start with an empty environment\n\
-  --help                     display this help and exit\n\
-  --version                  output version information and exit\n\
+      --help                 display this help and exit\n\
+      --version              output version information and exit\n\
 \n\
 A mere - implies -i.  If no COMMAND, print the resulting environment.\n\
 ");
index b39799ebad6d1854a6e297216dc30e3d7bdee1ef..22e7e83cc8e03010ac803cb5e566813ef57d499d 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "system.h"
 #include "version.h"
+#include "long-option.h"
 
 #if !defined (isascii) || defined (STDC_HEADERS)
 #undef isascii
 
 #define ISDIGIT(c) (isascii (c) && isdigit (c))
 
-#if !__STDC__
-#define const
-#endif
-
 #define NEW(type) ((type *) xmalloc (sizeof (type)))
 #define OLD(x) free ((char *) x)
 
@@ -91,7 +88,6 @@ void error ();
 char *xstrdup ();
 char *strstr ();
 char *xmalloc ();
-void parse_long_options ();
 
 static VALUE *docolon ();
 static VALUE *eval ();
@@ -121,7 +117,7 @@ Usage: %s EXPRESSION\n\
           program_name, program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
     {
@@ -155,7 +151,12 @@ separates increasing precedence groups.  EXPRESSION may be:\n\
 \n\
   STRING : REGEXP   anchored pattern match of REGEXP in STRING\n\
 \n\
-  ( EXPRESSION )    value of EXPRESSION\n\
+  match STRING REGEXP        same as STRING : REGEXP\n\
+  substr STRING POS LENGTH   substring of STRING, POS counted from 1\n\
+  index STRING CHARS         index in STRING where any CHARS is found, or 0\n\
+  length STRING              length of STRING\n\
+\n\
+  ( EXPRESSION )             value of EXPRESSION\n\
 ");
       printf ("\
 \n\
index 5200444492f0446d87e60f03190954327dfed2b5..3f2b32c5bba737af7efafb9955876b30f56a8d1e 100644 (file)
--- a/src/id.c
+++ b/src/id.c
@@ -369,7 +369,7 @@ Usage: %s [OPTION]... [USERNAME]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index a75208d10d41cdca9e9cd9e39d4956dfad57c45b..f8fcf38217f86ad1373ddbd1b10de10bd0cf71a6 100644 (file)
@@ -59,7 +59,7 @@ Usage: %s [OPTION]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 74bac8835801f930266639ccf3a4209b9895819f..616a8f31c5f4f386484196db637234d1e4643255 100644 (file)
@@ -180,7 +180,7 @@ Usage: %s [OPTION]... [COMMAND [ARG]...]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
@@ -188,8 +188,8 @@ Usage: %s [OPTION]... [COMMAND [ARG]...]\n\
 \n\
   -ADJUST                   increment priority by ADJUST first\n\
   -n, --adjustment ADJUST   same as -ADJUST\n\
-  --help                    display this help and exit\n\
-  --version                 output version information and exit\n\
+      --help                display this help and exit\n\
+      --version             output version information and exit\n\
 \n\
 With no COMMAND, print the current scheduling priority.  ADJUST is 10\n\
 by default.  Range goes from -20 (highest priority) to 19 (lowest).\n\
index 760742d1bdac61383bc813a4035a6faf7c29992d..afb663a623252ac3c4c1587322c7a7606b9053fe 100644 (file)
@@ -367,7 +367,7 @@ Usage: %s [OPTION]... PATH...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index ca13af365c77a81252695f0ea60252e1e7687edc..c6d476b6feb97387e1850276437fa9b44a0f6b81 100644 (file)
@@ -61,6 +61,7 @@
 
 #include "system.h"
 #include "version.h"
+#include "long-option.h"
 
 #if !defined (isascii) || defined (STDC_HEADERS)
 #undef isascii
@@ -82,7 +83,6 @@ unsigned long strtoul ();
 
 char *xmalloc ();
 void error ();
-void parse_long_options ();
 
 static double xstrtod ();
 static int print_esc ();
@@ -111,7 +111,7 @@ Usage: %s FORMAT [ARGUMENT]...\n\
           program_name, program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 168c31b91cd088148e30fcb0c33c2dfe748208b6..a98ce9da903de2a2ac655733258b8e29f7d868dc 100644 (file)
@@ -63,7 +63,7 @@ Usage: %s [OPTION]... NUMBER[SUFFIX]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index dec68a7a7509dfa6d1aac09ee75a1861c2fb33c7..c4d0946b2d35bf24aad0ea77e70caad8a052625c 100644 (file)
@@ -452,7 +452,7 @@ Usage: %s [OPTION]... [SETTING]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
     {
index f80963b1d5720d5209de84cda2a5f4e6b92335d7..7db31c107cc1eedf82e54085bdfbe89288146614 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -557,7 +557,7 @@ Usage: %s [OPTION]... [-] [USER [ARG]...]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index d99782bded26087304c11f4a39eb51ba4bfbcf83..66fccd9f83c750d72b531ec194cf27134365d780 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -76,7 +76,7 @@ Usage: %s [OPTION]... [FILE]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index d1bc7ad2821bf4a31f1f5c6cd910a4e035e43f0c..c3d5c54cb179f53538a7849e5e3d17d5673c70a4 100644 (file)
@@ -1008,7 +1008,7 @@ posixtest ()
 }
 
 #if defined (TEST_STANDALONE)
-void parse_long_options ();
+#include "long-option.h"
 
 static void
 usage (status)
@@ -1022,7 +1022,7 @@ Usage: %s EXPRESSION\n\
           program_name, program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
     {
index 96505b9b469893ca3b35a01da1a053140f1e9db1..83e3512ae84afc4861be4f70260cae77cda5c1e6 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -129,7 +129,7 @@ Usage: %s [OPTION]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 5d5ab0f3f8a6d4405d57a4c709d9add0f97061fd..01b5f020c37c0d17b8d19f6dc766d9fd7fd43dce 100644 (file)
@@ -194,7 +194,7 @@ Usage: %s [OPTION]...\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else
 
index 16bd3523fa3245704d96a6850131bb9f788bd092..8b122c85b11c8dd16404f0be0c7be201fda6aa02 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -468,7 +468,7 @@ Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n\
           program_name);
 
   if (status != 0)
-    fprintf (stderr, "\nTry `%s --help' for more information.\n",
+    fprintf (stderr, "Try `%s --help' for more information.\n",
             program_name);
   else