+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,
*/
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--;
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;
*/
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--;
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;