]> granicus.if.org Git - file/commitdiff
Terminate %s printing at first newline, don't chatter on aimlessly.
authorIan Darwin <ian@darwinsys.com>
Fri, 6 Nov 1987 11:25:31 +0000 (11:25 +0000)
committerIan Darwin <ian@darwinsys.com>
Fri, 6 Nov 1987 11:25:31 +0000 (11:25 +0000)
src/softmagic.c

index 0a3f685c69dd1fbc0933693ed59cb59c902160f5..fd5aed3f4175290f13bfee9f61d7f1bb866370de 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef        lint
 static char *moduleid = 
-       "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.6 1987/09/16 14:45:23 ian Exp $";
+       "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.7 1987/11/06 11:25:31 ian Exp $";
 #endif /* lint */
 
 extern char *progname;
@@ -94,6 +94,7 @@ struct magic *m;
 char *s;
 {
        register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);
+       char *pp, *strchr();
 
        switch (m->type) {
        case BYTE:
@@ -106,6 +107,8 @@ char *s;
                (void) printf(m->desc, p->l);
                break;
        case STRING:
+               if ((pp=strchr(p->s, '\n')) != NULL)
+                       *pp = '\0';
                (void) printf(m->desc, p->s);
                break;
        default: