#ifndef lint
static char *moduleid =
- "@(#)$Id: ascmagic.c,v 1.10 1992/09/08 15:36:39 ian Exp $";
+ "@(#)$Id: ascmagic.c,v 1.11 1992/09/11 10:08:52 ian Exp $";
#endif /* lint */
/* an optimisation over plain strcmp() */
{
int i, isblock, has_escapes = 0;
unsigned char *s;
+ char nbuf[HOWMANY];
char *token;
register struct names *p;
}
/* look for tokens from names.h - this is expensive! */
- s = buf;
+ /* make a copy of the buffer here because strtok() will destroy it */
+ s = (unsigned char*) memcpy(nbuf, buf, HOWMANY);
while ((token = strtok((char*)s, " \t\n\r\f")) != NULL) {
s = NULL; /* make strtok() keep on tokin' */
for (p = names; p < names + NNAMES; p++) {
#ifndef lint
static char *moduleid =
- "@(#)$Id: softmagic.c,v 1.14 1992/09/09 15:04:16 ian Exp $";
+ "@(#)$Id: softmagic.c,v 1.15 1992/09/11 10:09:26 ian Exp $";
#endif /* lint */
static int match __P((unsigned char *));
(m->reln & MASK) ? p->l & m->mask : p->l);
break;
case STRING:
- if ((pp=strchr(p->s, '\n')) != NULL)
- *pp = '\0';
+ if ((rt=strchr(p->s, '\n')) != NULL)
+ *rt = '\0';
(void) printf(m->desc, p->s);
+ *rt = '\n';
break;
case DATE:
pp = ctime((time_t*) &p->l);
if ((rt = strchr(pp, '\n')) != NULL)
*rt = '\0';
(void) printf(m->desc, pp);
+ *rt = '\n';
break;
default:
error("invalid m->type (%d) in mprint().\n", m->type);