update from automake-1.2 SH-UTILS-1_16a
authorJim Meyering <jim@meyering.net>
Wed, 25 Jun 1997 17:05:56 +0000 (17:05 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 25 Jun 1997 17:05:56 +0000 (17:05 +0000)
src/ansi2knr.1
src/ansi2knr.c

index 434ce8f..f9ee5a6 100644 (file)
@@ -1,19 +1,36 @@
-.TH ANSI2KNR 1 "31 December 1990" 
+.TH ANSI2KNR 1 "19 Jan 1996"
 .SH NAME
 ansi2knr \- convert ANSI C to Kernighan & Ritchie C
 .SH SYNOPSIS
 .I ansi2knr
-input_file output_file
+[--varargs] input_file [output_file]
 .SH DESCRIPTION
 If no output_file is supplied, output goes to stdout.
 .br
 There are no error messages.
 .sp
 .I ansi2knr
-recognizes functions by seeing a non-keyword identifier at the left margin, followed by a left parenthesis, with a right parenthesis as the last character on the line.  It will recognize a multi-line header if the last character on each line but the last is a left parenthesis or comma.  These algorithms ignore whitespace and comments, except that the function name must be the first thing on the line.
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments).  It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon.  These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
 .sp
 The following constructs will confuse it:
 .br
-     - Any other construct that starts at the left margin and follows the above syntax (such as a macro or function call).
+     - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
 .br
-     - Macros that tinker with the syntax of the function header.
+     - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility.  The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work.  ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
index 8731f6d..c6ee833 100644 (file)
@@ -140,14 +140,14 @@ program under the GPL.
  * Compensate for this here.
  */
 #ifdef isascii
-# undef HAVE_ISASCII           /* just in case */
-# define HAVE_ISASCII 1
+#  undef HAVE_ISASCII          /* just in case */
+#  define HAVE_ISASCII 1
 #else
 #endif
 #if STDC_HEADERS || !HAVE_ISASCII
-# define is_ascii(c) 1
+#  define is_ascii(c) 1
 #else
-# define is_ascii(c) isascii(c)
+#  define is_ascii(c) isascii(c)
 #endif
 
 #define is_space(c) (is_ascii(c) && isspace(c))
@@ -195,26 +195,30 @@ main(argc, argv)
                        exit(1);
                  }
          }
-       switch ( argc )
+       if (argc < 2 || argc > 3)
           {
-       default:
                printf("Usage: ansi2knr input_file [output_file]\n");
-               exit(0);
-       case 2:
-               out = stdout;
-               break;
-       case 3:
-               out = fopen(argv[2], "w");
-               if ( out == NULL )
-                  {    fprintf(stderr, "Cannot open output file %s\n", argv[2]);
                        exit(1);
                   }
-          }
        in = fopen(argv[1], "r");
        if ( in == NULL )
-          {    fprintf(stderr, "Cannot open input file %s\n", argv[1]);
+         {
+           fprintf(stderr, "Cannot open input file %s\n", argv[1]);
                exit(1);
           }
+       if (argc == 3)
+         {
+           out = fopen(argv[2], "w");
+           if ( out == NULL )
+             {
+               fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+               exit(1);
+             }
+         }
+       else
+         {
+           out = stdout;
+         }
        fprintf(out, "#line 1 \"%s\"\n", argv[1]);
        buf = malloc(bufsize);
        line = buf;