=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/file/Attic/apprentice.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- src/usr.bin/file/Attic/apprentice.c 2006/04/04 14:17:01 1.22 +++ src/usr.bin/file/Attic/apprentice.c 2006/10/31 18:06:27 1.23 @@ -1,4 +1,4 @@ -/* $OpenBSD: apprentice.c,v 1.22 2006/04/04 14:17:01 pedro Exp $ */ +/* $OpenBSD: apprentice.c,v 1.23 2006/10/31 18:06:27 ray Exp $ */ /* * Copyright (c) Ian F. Darwin 1986-1995. * Software written by Ian F. Darwin and others; @@ -46,7 +46,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.22 2006/04/04 14:17:01 pedro Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.23 2006/10/31 18:06:27 ray Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -311,11 +311,15 @@ /* parse it */ for (lineno = 1; fgets(line, sizeof(line), f) != NULL; lineno++) { + char *p; + if (line[0]=='#') /* comment, do not parse */ continue; if (strlen(line) <= (unsigned)1) /* null line, garbage, etc */ continue; - line[strlen(line)-1] = '\0'; /* delete newline */ + /* delete newline */ + if ((p = strchr(line, '\n')) != NULL) + *p = '\0'; if (parse(ms, magicp, nmagicp, line, action) != 0) errs = 1; }