summaryrefslogtreecommitdiff
path: root/contrib/file/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/file/print.c')
-rw-r--r--contrib/file/print.c60
1 files changed, 13 insertions, 47 deletions
diff --git a/contrib/file/print.c b/contrib/file/print.c
index b6803994448e..38ca9d37351c 100644
--- a/contrib/file/print.c
+++ b/contrib/file/print.c
@@ -26,8 +26,6 @@
*/
#include "file.h"
-#include <stdio.h>
-#include <errno.h>
#include <string.h>
#ifdef __STDC__
# include <stdarg.h>
@@ -41,20 +39,20 @@
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.34 2001/08/07 16:01:26 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.38 2002/07/03 18:37:44 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
+#ifndef COMPILE_ONLY
void
-mdump(m)
- struct magic *m;
+mdump(struct magic *m)
{
static const char *typ[] = { "invalid", "byte", "short", "invalid",
"long", "string", "date", "beshort",
"belong", "bedate", "leshort", "lelong",
"ledate", "pstring", "ldate", "beldate",
- "leldate" };
+ "leldate", "regex" };
static const char optyp[] = { '@', '&', '|', '^', '+', '-',
'*', '/', '%' };
(void) fputc('[', stderr);
@@ -110,6 +108,7 @@ mdump(m)
break;
case STRING:
case PSTRING:
+ case REGEX:
showstr(stderr, m->value.s, -1);
break;
case DATE:
@@ -129,15 +128,14 @@ mdump(m)
}
(void) fprintf(stderr, ",\"%s\"]\n", m->desc);
}
+#endif
/*
* ckfputs - fputs, but with error checking
* ckfprintf - fprintf, but with error checking
*/
void
-ckfputs(str, fil)
- const char *str;
- FILE *fil;
+ckfputs(const char *str, FILE *fil)
{
if (fputs(str,fil) == EOF)
error("write failed.\n");
@@ -145,23 +143,11 @@ ckfputs(str, fil)
/*VARARGS*/
void
-#ifdef __STDC__
ckfprintf(FILE *f, const char *fmt, ...)
-#else
-ckfprintf(va_alist)
- va_dcl
-#endif
{
va_list va;
-#ifdef __STDC__
+
va_start(va, fmt);
-#else
- FILE *f;
- const char *fmt;
- va_start(va);
- f = va_arg(va, FILE *);
- fmt = va_arg(va, const char *);
-#endif
(void) vfprintf(f, fmt, va);
if (ferror(f))
error("write failed.\n");
@@ -173,21 +159,11 @@ ckfprintf(va_alist)
*/
/*VARARGS*/
void
-#ifdef __STDC__
error(const char *f, ...)
-#else
-error(va_alist)
- va_dcl
-#endif
{
va_list va;
-#ifdef __STDC__
+
va_start(va, f);
-#else
- const char *f;
- va_start(va);
- f = va_arg(va, const char *);
-#endif
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
@@ -200,21 +176,11 @@ error(va_alist)
/*VARARGS*/
void
-#ifdef __STDC__
magwarn(const char *f, ...)
-#else
-magwarn(va_alist)
- va_dcl
-#endif
{
va_list va;
-#ifdef __STDC__
+
va_start(va, f);
-#else
- const char *f;
- va_start(va);
- f = va_arg(va, const char *);
-#endif
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
@@ -227,10 +193,9 @@ magwarn(va_alist)
}
+#ifndef COMPILE_ONLY
char *
-fmttime(v, local)
- long v;
- int local;
+fmttime(long v, int local)
{
char *pp, *rt;
time_t t = (time_t)v;
@@ -262,3 +227,4 @@ fmttime(v, local)
*rt = '\0';
return pp;
}
+#endif