version 1.30, 2015/04/24 16:47:32 |
version 1.31, 2015/04/24 17:10:50 |
|
|
|
|
__dead void usage(void); |
__dead void usage(void); |
|
|
static void open_file(struct input_file *, const char *, int *); |
static void prepare_file(struct input_file *, const char *, int *); |
|
static void open_file(struct input_file *); |
static void read_link(struct input_file *); |
static void read_link(struct input_file *); |
static void test_file(struct magic *, struct input_file *, int); |
static void test_file(struct magic *, struct input_file *, int); |
|
|
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
struct input_file inf; |
struct input_file *files = NULL; |
int opt, i, width = 0; |
int opt, i, width = 0; |
FILE *f; |
FILE *f; |
struct magic *m; |
struct magic *m; |
|
|
exit(0); |
exit(0); |
} |
} |
|
|
|
files = xcalloc(argc, sizeof *files); |
|
for (i = 0; i < argc; i++) |
|
prepare_file(&files[i], argv[i], &width); |
for (i = 0; i < argc; i++) { |
for (i = 0; i < argc; i++) { |
memset(&inf, 0, sizeof inf); |
open_file(&files[i]); |
open_file(&inf, argv[i], &width); |
test_file(m, &files[i], width); |
test_file(m, &inf, width); |
|
} |
} |
exit(0); |
exit(0); |
} |
} |
|
|
static void |
static void |
open_file(struct input_file *inf, const char *path, int *width) |
prepare_file(struct input_file *inf, const char *path, int *width) |
{ |
{ |
char *label; |
char *label; |
int n, retval; |
int n; |
|
|
inf->path = xstrdup(path); |
inf->path = xstrdup(path); |
|
|
|
|
if (n > *width) |
if (n > *width) |
*width = n; |
*width = n; |
inf->label = label; |
inf->label = label; |
|
} |
|
|
|
static void |
|
open_file(struct input_file *inf) |
|
{ |
|
int retval; |
|
|
retval = lstat(inf->path, &inf->sb); |
retval = lstat(inf->path, &inf->sb); |
if (retval == -1) { |
if (retval == -1) { |