#include <ctype.h>
#include "file.h"
+#ifndef lint
+static char *moduleid = "$Header: /home/glen/git/file/cvs/file/src/apprentice.c,v 1.6 1987/09/16 10:11:06 ian Exp $";
+#endif /* lint */
+
#define MAXSTR 500
#define EATAB {while (isascii(*l) && isspace(*l)) ++l;}
extern char *progname;
extern char *magicfile;
-extern int debug, check; /* options */
+extern int debug; /* option */
extern int nmagic; /* number of valid magic[]s */
extern long strtol();
char *getstr();
-apprentice(fn)
-char *fn;
+apprentice(fn, check)
+char *fn; /* name of magic file */
+int check; /* non-zero: checking-only run. */
{
FILE *f;
char line[MAXSTR+1];
if (strlen(line) <= 1) /* null line, garbage, etc */
continue;
line[strlen(line)-1] = '\0'; /* delete newline */
- (void) parse(line, &nmagic);
+ (void) parse(line, &nmagic, check);
}
(void) fclose(f);
/*
* parse one line from magic file, put into magic[index++] if valid
*/
-parse(l, ndx)
+parse(l, ndx, check)
char *l;
-int *ndx;
+int *ndx, check;
{
int i = 0, nd = *ndx;
int slen;
m->reln = '=';
EATAB;
-/* TODO finish this macro and start using it! */
-#define offsetcheck {if (offset > HOWMANY-1) warning("offset too big"); }
+/*
+ * TODO finish this macro and start using it!
+ * #define offsetcheck {if (offset > HOWMANY-1) warning("offset too big"); }
+ */
switch(m->type) {
/*
* Do not remove the casts below. They are vital.
#include "file.h"
#include "names.h"
+#ifndef lint
+static char *moduleid = "$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.4 1987/09/16 10:11:40 ian Exp $";
+#endif /* lint */
+
char ckfmsg[] = "write error on output";
/* an optimisation over plain strcmp() */
#include <sys/stat.h>
#include "file.h"
-#define USAGE "usage: %s [-f file] [-m magicfile] file...\n"
+#ifndef lint
+static char *moduleid = "$Header: /home/glen/git/file/cvs/file/src/fsmagic.c,v 1.5 1987/09/16 10:11:48 ian Exp $";
+#endif /* lint */
extern char *progname;
extern char *ckfmsg, *magicfile;
#include <stdio.h>
#include "file.h"
-#define USAGE "usage: %s [-f file] [-m magicfile] file...\n"
+#ifndef lint
+static char *moduleid = "$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.5 1987/09/16 10:12:01 ian Exp $";
+#endif /* lint */
extern char *progname;
extern char *magicfile; /* name of current /etc/magic or clone */