summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-01-04 07:40:05 +0100
committerTyge Løvset <[email protected]>2022-01-04 07:40:05 +0100
commit50ff8efaadeaa5803ec52142409d2f830f6f6b7a (patch)
tree3720968971580e61a5562909513cec46726b1012
parentbaf27e38144e50cc7af3618cd9335115ca5b2d28 (diff)
downloadSTC-modified-50ff8efaadeaa5803ec52142409d2f830f6f6b7a.tar.gz
STC-modified-50ff8efaadeaa5803ec52142409d2f830f6f6b7a.zip
checkauto.ll: Accept multiple input c-file arguments.
-rw-r--r--checkauto.ll26
1 files changed, 17 insertions, 9 deletions
diff --git a/checkauto.ll b/checkauto.ll
index 5aeb2d07..1a108076 100644
--- a/checkauto.ll
+++ b/checkauto.ll
@@ -109,18 +109,26 @@ c_breakauto { if (block_type != AUTO) {
int main(int argc, char **argv)
{
if (argc == 1 || strcmp(argv[1], "--help") == 0) {
- printf("usage: %s [--help] {C-file | -}\n", argv[0]);
+ printf("usage: %s [--help] {C-file... | -}\n", argv[0]);
return 0;
}
- if (strcmp(argv[1], "-") == 0) {
- fname = "<stdin>";
- yyin = stdin;
- } else {
- fname = argv[1];
- yyin = fopen(fname, "r");
- }
- yylex();
+ for (int i=1; i<argc; ++i) {
+ if (strcmp(argv[i], "-") == 0) {
+ fname = "<stdin>";
+ yyin = stdin;
+ } else {
+ fname = argv[i];
+ yyin = fopen(fname, "r");
+ }
+ yylineno = 1;
+ braces_lev = 0, block_lev = 0;
+ block_type = 0, state = NORMAL;
+
+ yylex();
+
+ fclose(yyin);
+ }
if (errors + warnings)
printf("%d error%s, %d warning%s.\n", errors, errors == 1? "":"s",
warnings, warnings == 1? "":"s");