summaryrefslogtreecommitdiff
path: root/usr.bin/file/apprentice.c
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2000-09-22 16:34:59 +0000
committerpooka <pooka@NetBSD.org>2000-09-22 16:34:59 +0000
commite5efd07a0bcfa67e020a523ca2712d5d429dc21e (patch)
tree95594a357126783c85bf2b817f3f723d6d8fb668 /usr.bin/file/apprentice.c
parentc45f82114cfbb9473b63a60442801cf660d65c8e (diff)
resolve conflicts
Diffstat (limited to 'usr.bin/file/apprentice.c')
-rw-r--r--usr.bin/file/apprentice.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/usr.bin/file/apprentice.c b/usr.bin/file/apprentice.c
index a2748e79aa5..2d06fa93ba6 100644
--- a/usr.bin/file/apprentice.c
+++ b/usr.bin/file/apprentice.c
@@ -1,4 +1,4 @@
-/* $NetBSD: apprentice.c,v 1.19 2000/05/14 22:53:37 christos Exp $ */
+/* $NetBSD: apprentice.c,v 1.20 2000/09/22 16:34:59 pooka Exp $ */
/*
* apprentice - make one pass through /etc/magic, learning its secrets.
@@ -39,7 +39,7 @@
#if 0
FILE_RCSID("@(#)Id: apprentice.c,v 1.32 2000/04/23 04:32:19 christos Exp ")
#else
-__RCSID("$NetBSD: apprentice.c,v 1.19 2000/05/14 22:53:37 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.20 2000/09/22 16:34:59 pooka Exp $");
#endif
#endif /* lint */
@@ -68,8 +68,8 @@ static int apprentice_1 __P((const char *, int));
int
apprentice(fn, check)
-const char *fn; /* list of magic files */
-int check; /* non-zero? checking-only run. */
+ const char *fn; /* list of magic files */
+ int check; /* non-zero? checking-only run. */
{
char *p, *mfn;
int file_err, errs = -1;
@@ -107,8 +107,8 @@ int check; /* non-zero? checking-only run. */
static int
apprentice_1(fn, check)
-const char *fn; /* name of magic file */
-int check; /* non-zero? checking-only run. */
+ const char *fn; /* name of magic file */
+ int check; /* non-zero? checking-only run. */
{
static const char hdr[] =
"cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
@@ -120,8 +120,8 @@ int check; /* non-zero? checking-only run. */
if (f==NULL) {
if (errno != ENOENT)
(void) fprintf(stderr,
- "%s: can't read magic file %s (%s)\n",
- progname, fn, strerror(errno));
+ "%s: can't read magic file %s (%s)\n",
+ progname, fn, strerror(errno));
return -1;
}
@@ -148,8 +148,8 @@ int check; /* non-zero? checking-only run. */
*/
uint32
signextend(m, v)
-struct magic *m;
-uint32 v;
+ struct magic *m;
+ uint32 v;
{
if (!(m->flag & UNSIGNED))
switch(m->type) {
@@ -189,8 +189,8 @@ uint32 v;
*/
static int
parse(l, ndx, check)
-char *l;
-int *ndx, check;
+ char *l;
+ int *ndx, check;
{
int i = 0, nd = *ndx;
struct magic *m;
@@ -451,8 +451,8 @@ GetDesc:
*/
static int
getvalue(m, p)
-struct magic *m;
-char **p;
+ struct magic *m;
+ char **p;
{
int slen;
@@ -475,14 +475,14 @@ char **p;
*/
static char *
getstr(s, p, plen, slen)
-register char *s;
-register char *p;
-int plen, *slen;
+ char *s;
+ char *p;
+ int plen, *slen;
{
char *origs = s, *origp = p;
char *pmax = p + plen - 1;
- register int c;
- register int val;
+ int c;
+ int val;
while ((c = *s++) != '\0') {
if (isspace((unsigned char) c))
@@ -578,13 +578,17 @@ out:
/* Single hex char to int; -1 if not a hex char. */
static int
hextoint(c)
-int c;
+ int c;
{
- if (!isascii((unsigned char) c)) return -1;
- if (isdigit((unsigned char) c)) return c - '0';
- if ((c>='a')&&(c<='f')) return c + 10 - 'a';
- if ((c>='A')&&(c<='F')) return c + 10 - 'A';
- return -1;
+ if (!isascii((unsigned char) c))
+ return -1;
+ if (isdigit((unsigned char) c))
+ return c - '0';
+ if ((c >= 'a')&&(c <= 'f'))
+ return c + 10 - 'a';
+ if (( c>= 'A')&&(c <= 'F'))
+ return c + 10 - 'A';
+ return -1;
}
@@ -593,11 +597,11 @@ int c;
*/
void
showstr(fp, s, len)
-FILE *fp;
-const char *s;
-int len;
+ FILE *fp;
+ const char *s;
+ int len;
{
- register char c;
+ char c;
for (;;) {
c = *s++;
@@ -652,7 +656,7 @@ int len;
*/
static void
eatsize(p)
-char **p;
+ char **p;
{
char *l = *p;