#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.63 2003/09/12 19:19:22 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.64 2003/09/12 19:39:44 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
return -1;
}
- /* parse it */
- if (action == FILE_CHECK) /* print silly verbose header for USG compat. */
+ /* print silly verbose header for USG compat. */
+ if (action == FILE_CHECK)
(void)fprintf(stderr, "%s\n", hdr);
+ /* parse it */
for (lineno = 1; fgets(line, BUFSIZ, f) != NULL; lineno++) {
if (line[0]=='#') /* comment, do not parse */
continue;
case FILE_PSTRING:
case FILE_REGEX:
*p = getstr(ms, *p, m->value.s, sizeof(m->value.s), &slen);
- if (*p == NULL)
+ if (*p == NULL) {
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn("Cannot get string from `%s'",
+ m->value.s);
return -1;
+ }
m->vallen = slen;
return 0;
default:
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.80 2003/07/10 21:10:16 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.81 2003/09/12 19:39:44 christos Exp $")
#endif /* lint */
action = FILE_COMPILE;
break;
case 'd':
- flags |= MAGIC_DEBUG;
+ flags |= MAGIC_DEBUG|MAGIC_CHECK;
break;
case 'f':
if(action)
if (ms->haderr)
return;
va_start(va, f);
-
- /* cuz we use stdout for most, stderr here */
- (void) fflush(stdout);
-
(void) vsnprintf(ms->o.buf, ms->o.size, f, va);
ms->haderr++;
va_end(va);
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.43 2003/03/26 15:35:30 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.44 2003/09/12 19:39:44 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
+ (void) fprintf(stderr, "WARNING: ");
(void) vfprintf(stderr, f, va);
va_end(va);
fputc('\n', stderr);