56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
|
--- src/file.c
|
||
|
+++ src/file.c 2007-05-14 11:14:56.000000000 +0000
|
||
|
@@ -128,7 +128,7 @@ main(int argc, char *argv[])
|
||
|
char *home, *usermagic;
|
||
|
struct stat sb;
|
||
|
static const char hmagic[] = "/.magic";
|
||
|
-#define OPTSTRING "bcCdf:F:hikLm:nNprsvz0"
|
||
|
+#define OPTSTRING "bcCde:f:F:hikLm:nNprsvz0"
|
||
|
#ifdef HAVE_GETOPT_LONG
|
||
|
int longindex;
|
||
|
static const struct option long_options[] =
|
||
|
@@ -138,7 +138,7 @@ main(int argc, char *argv[])
|
||
|
{"brief", 0, 0, 'b'},
|
||
|
{"checking-printout", 0, 0, 'c'},
|
||
|
{"debug", 0, 0, 'd'},
|
||
|
- {"exclude", 0, 0, 'e' },
|
||
|
+ {"exclude", 1, 0, 'e' },
|
||
|
{"files-from", 1, 0, 'f'},
|
||
|
{"separator", 1, 0, 'F'},
|
||
|
{"mime", 0, 0, 'i'},
|
||
|
@@ -240,6 +240,8 @@ main(int argc, char *argv[])
|
||
|
flags |= MAGIC_DEBUG|MAGIC_CHECK;
|
||
|
break;
|
||
|
case 'e':
|
||
|
+ if (!optarg)
|
||
|
+ usage();
|
||
|
for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++)
|
||
|
if (strcmp(nv[i].name, optarg) == 0)
|
||
|
break;
|
||
|
@@ -251,13 +253,15 @@ main(int argc, char *argv[])
|
||
|
break;
|
||
|
|
||
|
case 'f':
|
||
|
- if(action)
|
||
|
+ if(action || !optarg)
|
||
|
usage();
|
||
|
load(magicfile, flags);
|
||
|
unwrap(optarg);
|
||
|
++didsomefiles;
|
||
|
break;
|
||
|
case 'F':
|
||
|
+ if (!optarg)
|
||
|
+ usage();
|
||
|
separator = optarg;
|
||
|
break;
|
||
|
case 'i':
|
||
|
@@ -267,6 +271,8 @@ main(int argc, char *argv[])
|
||
|
flags |= MAGIC_CONTINUE;
|
||
|
break;
|
||
|
case 'm':
|
||
|
+ if (!optarg)
|
||
|
+ usage();
|
||
|
magicfile = optarg;
|
||
|
break;
|
||
|
case 'n':
|