-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind-bad.cc
More file actions
47 lines (40 loc) · 829 Bytes
/
Copy pathfind-bad.cc
File metadata and controls
47 lines (40 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cstdio>
#include "FindJpeg.hh"
#include "ValidJpeg.hh"
int main (int ac, const char ** argv )
{
if (ac < 2)
{
fprintf (stderr, "Usage: %s DIR ...\n", *argv);
return 1;
}
for (int i=1; i<ac; ++i)
{
FindJpeg fj(argv[i]);
ValidJpeg vj;
while (fj.next())
{
const char * file = fj.get_c();
//fprintf(stderr, "got file: %s\n", file);
if (file == 0)
{
fprintf(stderr, "null file return\n");
continue;
}
else if (file[0] == 0)
{
fprintf(stderr, "empty file name return\n");
continue;
}
else if (not vj.open(file) )
{
perror(file);
continue;
}
int status = vj.valid_jpeg();
//int status = vj.short_jpeg();
if (status != 0)
puts(file);
}
}
}