version 1.8, 2002/02/16 21:27:46 |
version 1.9, 2002/11/29 00:27:03 |
|
|
#include "file.h" |
#include "file.h" |
|
|
#ifdef S_IFLNK |
#ifdef S_IFLNK |
# define USAGE "Usage: %s [-vczL] [-f namefile] [-m magicfiles] file...\n" |
# define USAGE "Usage: %s [-vbczL] [-f namefile] [-m magicfiles] file...\n" |
#else |
#else |
# define USAGE "Usage: %s [-vcz] [-f namefile] [-m magicfiles] file...\n" |
# define USAGE "Usage: %s [-vbcz] [-f namefile] [-m magicfiles] file...\n" |
#endif |
#endif |
|
|
#ifndef MAGIC |
#ifndef MAGIC |
|
|
|
|
int /* Global command-line options */ |
int /* Global command-line options */ |
debug = 0, /* debugging */ |
debug = 0, /* debugging */ |
|
bflag = 0, /* Don't print filename */ |
lflag = 0, /* follow Symlinks (BSD only) */ |
lflag = 0, /* follow Symlinks (BSD only) */ |
zflag = 0; /* follow (uncompress) compressed files */ |
zflag = 0; /* follow (uncompress) compressed files */ |
|
|
|
|
if (!(magicfile = getenv("MAGIC"))) |
if (!(magicfile = getenv("MAGIC"))) |
magicfile = MAGIC; |
magicfile = MAGIC; |
|
|
while ((c = getopt(argc, argv, "vcdf:Lm:z")) != -1) |
while ((c = getopt(argc, argv, "bvcdf:Lm:z")) != -1) |
switch (c) { |
switch (c) { |
case 'v': |
case 'v': |
(void) printf("%s-%d.%d\n", __progname, |
(void) printf("%s-%d.%d\n", __progname, |
FILE_VERSION_MAJOR, patchlevel); |
FILE_VERSION_MAJOR, patchlevel); |
return 1; |
return 1; |
|
case 'b': |
|
++bflag; |
|
break; |
case 'c': |
case 'c': |
++check; |
++check; |
break; |
break; |
|
|
inname = stdname; |
inname = stdname; |
} |
} |
|
|
if (wid > 0) |
if (wid > 0 && !bflag) |
(void) printf("%s:%*s ", inname, |
(void) printf("%s:%*s ", inname, |
(int) (wid - strlen(inname)), ""); |
(int) (wid - strlen(inname)), ""); |
|
|