summaryrefslogtreecommitdiff
path: root/src/ansi2knr.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-06-25 17:05:56 +0000
committerJim Meyering <jim@meyering.net>1997-06-25 17:05:56 +0000
commitf657d65570c7389f9c60e2ff9d850206e5ce3b57 (patch)
treec894d57bde8fe8ecc5cd43d86d548144834639a9 /src/ansi2knr.c
parent9bcfe15afebe3a8be6fd7f2417b34abc22ea9d17 (diff)
downloadcoreutils-f657d65570c7389f9c60e2ff9d850206e5ce3b57.tar.xz
update from automake-1.2
Diffstat (limited to 'src/ansi2knr.c')
-rw-r--r--src/ansi2knr.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/ansi2knr.c b/src/ansi2knr.c
index 8731f6ddd..c6ee83309 100644
--- a/src/ansi2knr.c
+++ b/src/ansi2knr.c
@@ -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;