.
authorJim Meyering <jim@meyering.net>
Fri, 25 Mar 1994 23:38:00 +0000 (23:38 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 25 Mar 1994 23:38:00 +0000 (23:38 +0000)
src/cat.c
src/csplit.c
src/expand.c
src/od.c
src/paste.c
src/sort.c

index 63128e0..2337174 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -288,7 +288,13 @@ main (argc, argv)
       out_ino = stat_buf.st_ino;
     }
   else
-    check_redirection = 0;
+    {
+      check_redirection = 0;
+#ifdef lint  /* Suppress `used before initialized' warning.  */
+      out_dev = 0;
+      out_ino = 0;
+#endif
+    }
 
   /* Check if any of the input files are the same as the output file.  */
 
@@ -549,9 +555,11 @@ cat (inbuf, insize, outbuf, outsize, quote,
                     HP-UX returns ENOTTY on pipes.
                     SunOS returns EINVAL and
                     More/BSD returns ENODEV on special files
-                    like /dev/null.  */
+                    like /dev/null.
+                    Irix-5 returns ENOSYS on pipes.  */
                  if (errno == EOPNOTSUPP || errno == ENOTTY
-                     || errno == EINVAL || errno == ENODEV)
+                     || errno == EINVAL || errno == ENODEV
+                     || errno == ENOSYS)
                    use_fionread = 0;
                  else
                    {
index ad13b26..722aed9 100644 (file)
@@ -236,7 +236,7 @@ static struct option const longopts[] =
   {"keep-files", no_argument, NULL, 'k'},
   {"elide-empty-files", no_argument, NULL, 'z'},
   {"prefix", required_argument, NULL, 'f'},
-  {"suffix", required_argument, NULL, 'b'},
+  {"suffix-format", required_argument, NULL, 'b'},
   {"help", no_argument, &show_help, 1},
   {"version", no_argument, &show_version, 1},
   {NULL, 0, NULL, 0}
@@ -1574,8 +1574,8 @@ Usage: %s [OPTION]... FILE PATTERN...\n\
              program_name);
       printf ("\
 \n\
-  -b, --suffix=FORMAT        use sprintf FORMAT instead of %%d\n\
-  -f, --prefix=PREFIX        use PREFIX instead of xx\n\
+  -b, --suffix-format=FORMAT use sprintf FORMAT instead of %%d\n\
+  -f, --prefix=PREFIX        use PREFIX instead of `xx'\n\
   -k, --keep-files           do not remove output files on errors\n\
   -n, --digits=DIGITS        use specified number of digits instead of 2\n\
   -s, --quiet, --silent      do not print counts of output file sizes\n\
@@ -1591,7 +1591,7 @@ Read standard input if FILE is -.  Each PATTERN may be:\n\
   {INTEGER}          repeat the previous pattern specified number of times\n\
   {*}                repeat the previous pattern as many times as possible\n\
 \n\
-A line OFFSET is a `+' or `-' (required) followed by a positive integer.\n\
+A line OFFSET is a required `+' or `-' followed by a positive integer.\n\
 ");
     }
   exit (status);
index 52b3f0e..b179504 100644 (file)
@@ -277,6 +277,8 @@ expand ()
   int convert = 1;             /* If nonzero, perform translations. */
 
   fp = next_file ((FILE *) NULL);
+  if (fp == NULL)
+    return;
   for (;;)
     {
       c = getc (fp);
index 35d1cdd..d03ff34 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -1040,9 +1040,10 @@ decode_format_string (s)
 /* Given a list of one or more input filenames FILE_LIST, set the global
    file pointer IN_STREAM to position N_SKIP in the concatenation of
    those files.  If any file operation fails or if there are fewer than
-   N_SKIP bytes in the combined input, give an error message and exit.
-   When possible, use seek- rather than read operations to advance
-   IN_STREAM.  A file name of "-" is interpreted as standard input.  */
+   N_SKIP bytes in the combined input, give an error message and return
+   non-zero.  When possible, use seek- rather than read operations to
+   advance IN_STREAM.  A file name of "-" is interpreted as standard
+   input.  */
 
 static int
 skip (n_skip)
@@ -1495,6 +1496,10 @@ dump ()
   size_t n_bytes_read;
   size_t end_offset;
 
+#ifdef lint  /* Suppress `used before initialized' warning.  */
+  end_offset = 0;
+#endif
+
   block[0] = (char *) alloca (bytes_per_block);
   block[1] = (char *) alloca (bytes_per_block);
 
@@ -1702,6 +1707,10 @@ main (argc, argv)
      after any true address.  */
   long int pseudo_start;
 
+#ifdef lint  /* Suppress `used before initialized' warning.  */
+  pseudo_start = 0;
+#endif
+
   program_name = argv[0];
   err = 0;
 
@@ -1993,6 +2002,8 @@ main (argc, argv)
     }
 
   err |= skip (n_bytes_to_skip);
+  if (in_stream == NULL)
+    goto cleanup;
 
   pseudo_offset = (flag_pseudo_start ? pseudo_start - n_bytes_to_skip : 0);
 
@@ -2028,6 +2039,8 @@ main (argc, argv)
 
   err |= (flag_dump_strings ? dump_strings () : dump ());
 
+cleanup:;
+
   if (have_read_stdin && fclose (stdin) == EOF)
     error (2, errno, "standard input");
 
index a8fdd28..933a326 100644 (file)
@@ -257,6 +257,10 @@ paste_parallel (nfiles, fnamptr)
   int i;                       /* Loop index. */
   int opened_stdin = 0;                /* Nonzero if any fopen got fd 0. */
 
+#ifdef lint  /* Suppress `used before initialized' warning.  */
+  chr = 0;
+#endif
+
   delbuf = (char *) xmalloc (file_list_size + 2);
   fileptr = (FILE **) xmalloc ((file_list_size + 1) * sizeof (FILE *));
 
index 166d8db..eb480ae 100644 (file)
@@ -107,17 +107,17 @@ static struct month
 
 /* Initial buffer size for in core sorting.  Will not grow unless a
    line longer than this is seen. */
-static int sortalloc =  524288;
+static int sortalloc = 4 * 1024 * 1024;
 
 /* Initial buffer size for in core merge buffers.  Bear in mind that
    up to NMERGE * mergealloc bytes may be allocated for merge buffers. */
-static int mergealloc =  16384;
+static int mergealloc =  64 * 1024;
 
 /* Guess of average line length. */
 static int linelength = 30;
 
 /* Maximum number of elements for the array(s) of struct line's, in bytes.  */
-#define LINEALLOC 262144
+#define LINEALLOC (1024 * 1024)
 
 /* Prefix for temporary file names. */
 static char *temp_file_prefix;