diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-08 20:11:50 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-09 18:21:25 +0400 |
commit | a11593189b264e70830a0c25c289f9db81dc8ee3 (patch) | |
tree | 3061805a1aaad0e04e91623dae8223f3c3d6c259 /tools | |
parent | 3d66ce17b7f809b195595ec5e785a67957e48e7d (diff) |
ffadler: add multifile support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ffadler.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/ffadler.c b/tools/ffadler.c index ff0e31f2cc..3f9c1616f3 100644 --- a/tools/ffadler.c +++ b/tools/ffadler.c @@ -36,15 +36,15 @@ #define SIZE 65536 -int main(int argc, char **argv) +static int check(char *file) { uint8_t buffer[SIZE]; uint32_t checksum = 1; int fd; int ret = 0; - if (argc > 1) fd = open(argv[1], O_RDONLY); - else fd = 0; + if (file) fd = open(file, O_RDONLY); + else fd = 0; if (fd == -1) { printf("A32=OPEN-FAILED-%d\n", errno); ret = 1; @@ -65,9 +65,23 @@ int main(int argc, char **argv) printf("A32=0x%08x", checksum); end: - if (argc > 1) - printf(" *%s", argv[1]); + if (file) + printf(" *%s", file); printf("\n"); return ret; } + +int main(int argc, char **argv) +{ + int i; + int ret = 0; + + for (i = 1; i<argc; i++) + ret |= check(argv[i]); + + if (argc == 1) + ret |= check(NULL); + + return ret; +} |