]> sourceware.org Git - automake.git/commitdiff
new version of ansi2knr
authorTom Tromey <tromey@redhat.com>
Mon, 23 Mar 1998 14:57:01 +0000 (14:57 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 23 Mar 1998 14:57:01 +0000 (14:57 +0000)
ChangeLog
ansi2knr.c
lib/ansi2knr.c

index 0ca4953168098e66adfaed88c7839a4a0643f8cc..325ffcaedaa173caeee3b93536ac00c189e6c0a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 23 07:55:04 1998  Tom Tromey  <tromey@cygnus.com>
+
+       * ansi2knr.c, ansi2knr.1: New versions from ghostscript.
+       (main): Reapplied "-" change from Harlan Stenn.
+
 Fri Mar 20 22:42:30 1998  Tom Tromey  <tromey@cygnus.com>
 
        * automake.in (scan_one_configure_file): Use &am_conf_line_error,
index f7d5cc339d71f946178e8204b64bbd16c6d34f8d..791eee04c09e7a7e78988679a2775322ddc8bfc3 100644 (file)
@@ -184,7 +184,7 @@ main(argc, argv)
         */
        int convert_varargs = 1;
 
-       if ( argc > 1 && argv[1][0] == '-'  && argv[1][1])
+       if ( argc > 1 && argv[1][0] == '-' && argv[1][1] )
          {     if ( !strcmp(argv[1], "--varargs") )
                  {     convert_varargs = 1;
                        argc--;
@@ -195,33 +195,29 @@ main(argc, argv)
                        exit(1);
                  }
          }
-       if (argc < 2 || argc > 3)
+       switch ( argc )
           {
+       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);
                   }
-       if (argv[1][0] == '-' && !argv[1][1])
-         in = stdin;
+          }
+       if ( argv[1][0] == '-' && !argv[1][1] )
+          in = stdin;
        else
-         in = fopen(argv[1], "r");
+          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;
index f7d5cc339d71f946178e8204b64bbd16c6d34f8d..791eee04c09e7a7e78988679a2775322ddc8bfc3 100644 (file)
@@ -184,7 +184,7 @@ main(argc, argv)
         */
        int convert_varargs = 1;
 
-       if ( argc > 1 && argv[1][0] == '-'  && argv[1][1])
+       if ( argc > 1 && argv[1][0] == '-' && argv[1][1] )
          {     if ( !strcmp(argv[1], "--varargs") )
                  {     convert_varargs = 1;
                        argc--;
@@ -195,33 +195,29 @@ main(argc, argv)
                        exit(1);
                  }
          }
-       if (argc < 2 || argc > 3)
+       switch ( argc )
           {
+       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);
                   }
-       if (argv[1][0] == '-' && !argv[1][1])
-         in = stdin;
+          }
+       if ( argv[1][0] == '-' && !argv[1][1] )
+          in = stdin;
        else
-         in = fopen(argv[1], "r");
+          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;
This page took 0.048002 seconds and 5 git commands to generate.