version 1.2, 1996/06/26 05:32:54 |
version 1.3, 1997/02/09 23:58:18 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
|
/* |
/* |
* ASCII magic -- file types that we know based on keywords |
* ASCII magic -- file types that we know based on keywords |
* that can appear anywhere in the file. |
* that can appear anywhere in the file. |
|
|
return 1; |
return 1; |
} |
} |
|
|
|
|
|
/* Make sure we are dealing with ascii text before looking for tokens */ |
|
for (i = 0; i < nbytes; i++) { |
|
if (!isascii(buf[i])) |
|
return 0; /* not all ASCII */ |
|
} |
|
|
/* look for tokens from names.h - this is expensive! */ |
/* look for tokens from names.h - this is expensive! */ |
/* make a copy of the buffer here because strtok() will destroy it */ |
/* make a copy of the buffer here because strtok() will destroy it */ |
s = (unsigned char*) memcpy(nbuf, buf, nbytes); |
s = (unsigned char*) memcpy(nbuf, buf, nbytes); |
|
|
return 1; |
return 1; |
} |
} |
} |
} |
} |
|
|
|
|
|
for (i = 0; i < nbytes; i++) { |
|
if (!isascii(buf[i])) |
|
return 0; /* not all ASCII */ |
|
} |
} |
|
|
/* all else fails, but it is ASCII... */ |
/* all else fails, but it is ASCII... */ |