diff --git a/usr.bin/file/ascmagic.c b/usr.bin/file/ascmagic.c index 4280b5180ae4..2250bba5cd99 100644 --- a/usr.bin/file/ascmagic.c +++ b/usr.bin/file/ascmagic.c @@ -36,7 +36,7 @@ #ifndef lint static char *moduleid = - "@(#)$Id: ascmagic.c,v 1.2 1995/05/30 06:29:59 rgrimes Exp $"; + "@(#)$Id: ascmagic.c,v 1.3 1996/01/23 12:40:06 mpp Exp $"; #endif /* lint */ /* an optimisation over plain strcmp() */ @@ -88,6 +88,12 @@ int nbytes; /* size actually read */ return 1; } + + for (i = 0; i < nbytes; i++) { + if (!isascii(buf[i])) + return 0; /* not all ASCII */ + } + /* look for tokens from names.h - this is expensive! */ /* make a copy of the buffer here because strtok() will destroy it */ s = (unsigned char*) memcpy(nbuf, buf, nbytes); @@ -106,12 +112,6 @@ int nbytes; /* size actually read */ } } - - for (i = 0; i < nbytes; i++) { - if (!isascii(buf[i])) - return 0; /* not all ASCII */ - } - /* all else fails, but it is ASCII... */ ckfputs("ASCII text", stdout); if (has_escapes) {