Commit 2225674d authored by Lev Walkin's avatar Lev Walkin

cosmetics

parent 1f05facc
...@@ -45,7 +45,6 @@ main(int ac, char **av) { ...@@ -45,7 +45,6 @@ main(int ac, char **av) {
enum asn1f_flags fixer_flags = A1F_NOFLAGS; enum asn1f_flags fixer_flags = A1F_NOFLAGS;
const char *filename; const char *filename;
size_t len; size_t len;
int ret;
/* /*
* Just in case when one decides that some flags better be * Just in case when one decides that some flags better be
...@@ -69,7 +68,7 @@ main(int ac, char **av) { ...@@ -69,7 +68,7 @@ main(int ac, char **av) {
top_srcdir); top_srcdir);
fprintf(stderr, "Testing in %s...\n", top_srcdir); fprintf(stderr, "Testing in %s...\n", top_srcdir);
ret = chdir(asn1_tests_dirname->buffer); int ret = chdir(asn1_tests_dirname->buffer);
if(ret == -1) if(ret == -1)
fprintf(stderr, "%s: %s\n", asn1_tests_dirname->buffer, fprintf(stderr, "%s: %s\n", asn1_tests_dirname->buffer,
strerror(errno)); strerror(errno));
...@@ -89,59 +88,57 @@ main(int ac, char **av) { ...@@ -89,59 +88,57 @@ main(int ac, char **av) {
/* /*
* Scan every *.asn1 file and try to parse and fix it. * Scan every *.asn1 file and try to parse and fix it.
*/ */
if(dir) { if(dir) {
#ifdef _WIN32 #ifdef _WIN32
do { do {
filename = c_file.name; filename = c_file.name;
#else #else
while((dp = readdir(dir))) { while((dp = readdir(dir))) {
filename = dp->d_name; filename = dp->d_name;
#endif /* _WIN32 */ #endif /* _WIN32 */
len = strlen(filename); len = strlen(filename);
if(len <= 5 || !isdigit(filename[0]) || strcmp(filename + len - 5, ".asn1")) if(len <= 5 || !isdigit(filename[0])
continue; || strcmp(filename + len - 5, ".asn1"))
ret = check(filename, parser_flags, fixer_flags); continue;
if(ret) { int ret = check(filename, parser_flags, fixer_flags);
fprintf(stderr, "FAILED: %s\n", if(ret) {
filename); fprintf(stderr, "FAILED: %s\n", filename);
failed++; failed++;
} }
completed++; completed++;
#ifdef _WIN32 #ifdef _WIN32
} while(_findnext(dir, &c_file) == 0); } while(_findnext(dir, &c_file) == 0);
_findclose(dir); _findclose(dir);
#else #else
} }
closedir(dir); closedir(dir);
#endif /* _WIN32 */ #endif /* _WIN32 */
fprintf(stderr, fprintf(stderr,
"Tests COMPLETED: %d\n" "Tests COMPLETED: %d\n"
"Tests FAILED: %d\n" "Tests FAILED: %d\n",
, completed, failed);
completed, failed } else {
); for(int i = 1; i < ac; i++) {
} else { int ret = check(av[i], parser_flags, fixer_flags);
int i; if(ret) {
for(i = 1; i < ac; i++) { fprintf(stderr, "FAILED: %s\n", av[i]);
ret = check(av[i], parser_flags, fixer_flags); failed++;
if(ret) { }
fprintf(stderr, "FAILED: %s\n", av[i]); completed++;
failed++; }
} }
completed++;
}
}
if(completed == 0) { if(completed == 0) {
fprintf(stderr, "No tests defined?!\n"); fprintf(stderr, "No tests defined?!\n");
exit(EX_NOINPUT); exit(EX_NOINPUT);
} }
if(failed) if(failed) {
exit(EX_DATAERR); exit(EX_DATAERR);
return 0; }
return 0;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment