summaryrefslogtreecommitdiffstats
path: root/usr.bin/file/apprentice.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-02-09 23:58:12 +0000
committermillert <millert@openbsd.org>1997-02-09 23:58:12 +0000
commit368e9f69976c9daa3823ec2771a9854e9bbaf0ff (patch)
tree831090f371737a8350f43add1f8a9845bfcb73bd /usr.bin/file/apprentice.c
parentMissed this one before. (diff)
downloadwireguard-openbsd-368e9f69976c9daa3823ec2771a9854e9bbaf0ff.tar.xz
wireguard-openbsd-368e9f69976c9daa3823ec2771a9854e9bbaf0ff.zip
Updates file(1) to version 3.22 by way to NetBSD.
Diffstat (limited to 'usr.bin/file/apprentice.c')
-rw-r--r--usr.bin/file/apprentice.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/file/apprentice.c b/usr.bin/file/apprentice.c
index c6311b8885c..8a5ccbec20f 100644
--- a/usr.bin/file/apprentice.c
+++ b/usr.bin/file/apprentice.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: apprentice.c,v 1.3 1996/06/26 05:32:54 deraadt Exp $ */
+/* $OpenBSD: apprentice.c,v 1.4 1997/02/09 23:58:16 millert Exp $ */
+
/*
* apprentice - make one pass through /etc/magic, learning its secrets.
*
@@ -34,7 +35,7 @@
#include "file.h"
#ifndef lint
-static char *moduleid = "$OpenBSD: apprentice.c,v 1.3 1996/06/26 05:32:54 deraadt Exp $";
+static char *moduleid = "$OpenBSD: apprentice.c,v 1.4 1997/02/09 23:58:16 millert Exp $";
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
@@ -133,10 +134,10 @@ int check; /* non-zero? checking-only run. */
/*
* extend the sign bit if the comparison is to be signed
*/
-unsigned long
+uint32
signextend(m, v)
struct magic *m;
-unsigned long v;
+uint32 v;
{
if (!(m->flag & UNSIGNED))
switch(m->type) {
@@ -159,7 +160,7 @@ unsigned long v;
case LONG:
case BELONG:
case LELONG:
- v = (long) v;
+ v = (int32) v;
break;
case STRING:
break;
@@ -210,6 +211,10 @@ int *ndx, check;
++l; /* step over */
m->flag |= INDIR;
}
+ if (m->cont_level != 0 && *l == '&') {
+ ++l; /* step over */
+ m->flag |= ADD;
+ }
/* get offset, then skip over it */
m->offset = (int) strtoul(l,&t,0);
@@ -491,21 +496,16 @@ int plen, *slen;
*p++ = (char)val;
break;
- /* \x and up to 3 hex digits */
+ /* \x and up to 2 hex digits */
case 'x':
val = 'x'; /* Default if no digits */
c = hextoint(*s++); /* Get next char */
if (c >= 0) {
val = c;
c = hextoint(*s++);
- if (c >= 0) {
+ if (c >= 0)
val = (val << 4) + c;
- c = hextoint(*s++);
- if (c >= 0) {
- val = (val << 4) + c;
- } else
- --s;
- } else
+ else
--s;
} else
--s;