(usage): Include one- or two-line synopsis in --help output.
[platform/upstream/coreutils.git] / src / expand.c
index b179504..d7366a2 100644 (file)
@@ -1,5 +1,5 @@
 /* expand - convert tabs to spaces
-   Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1991, 1995 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
 
    David MacKenzie <djm@gnu.ai.mit.edu> */
 
-#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
-   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
-   (which it would do because it found this file in $srcdir).  */
 #include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
 
 /* Get isblank from GNU libc.  */
 #define _GNU_SOURCE
@@ -52,6 +43,7 @@
 #include <sys/types.h>
 #include "system.h"
 #include "version.h"
+#include "error.h"
 
 /* The number of bytes added at a time to the amount of memory
    allocated for the output line. */
@@ -63,7 +55,6 @@
 
 char *xmalloc ();
 char *xrealloc ();
-void error ();
 
 static FILE *next_file ();
 static void add_tabstop ();
@@ -166,7 +157,7 @@ main (argc, argv)
 
   if (show_version)
     {
-      printf ("%s\n", version_string);
+      printf ("expand - %s\n", version_string);
       exit (0);
     }
 
@@ -238,7 +229,8 @@ add_tabstop (tabval)
   if (tabval == -1)
     return;
   if (first_free_tab % TABLIST_BLOCK == 0)
-    tab_list = (int *) xrealloc (tab_list, first_free_tab + TABLIST_BLOCK);
+    tab_list = (int *) xrealloc (tab_list, first_free_tab
+                                + TABLIST_BLOCK * sizeof (tab_list[0]));
   tab_list[first_free_tab++] = tabval;
 }
 
@@ -406,6 +398,8 @@ Usage: %s [OPTION]... [FILE]...\n\
 ",
              program_name);
       printf ("\
+Convert tabs in each FILE to spaces, writing to standard output.\n\
+With no FILE, or when FILE is -, read standard input.\n\
 \n\
   -i, --initial       do not convert TABs after non whitespace\n\
   -t, --tabs=NUMBER   have tabs NUMBER characters apart, not 8\n\
@@ -413,8 +407,7 @@ Usage: %s [OPTION]... [FILE]...\n\
       --help          display this help and exit\n\
       --version       output version information and exit\n\
 \n\
-Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.  With\n\
-no FILE, or when FILE is -, read standard input.\n\
+Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
 ");
     }
   exit (status);