- Fix for possible unset uid/gid in toproto - Fix for default mtree style - Update libelf - Importing libexecinfo - Resynchronize GCC, mpc, gmp, mpfr - build.sh: Replace params with show-params. This has been done as the make target has been renamed in the same way, while a new target named params has been added. This new target generates a file containing all the parameters, instead of printing it on the console. - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org) get getservbyport() out of the inner loop Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
90 lines
1.6 KiB
C
90 lines
1.6 KiB
C
/* $NetBSD: dump.c,v 1.2 2013/11/22 15:52:04 christos Exp $ */
|
|
/*-
|
|
* Copyright (c) 1992, 1993, 1994
|
|
* The Regents of the University of California. All rights reserved.
|
|
*
|
|
* %sccs.include.redist.c%
|
|
*/
|
|
|
|
#ifndef lint
|
|
static char copyright[] =
|
|
"%Z% Copyright (c) 1992, 1993, 1994\n\
|
|
The Regents of the University of California. All rights reserved.\n";
|
|
#endif /* not lint */
|
|
|
|
#ifndef lint
|
|
static char sccsid[] = "Id: dump.c,v 8.1 1994/08/31 13:27:37 bostic Exp (Berkeley) Date: 1994/08/31 13:27:37 ";
|
|
#endif /* not lint */
|
|
|
|
#include <ctype.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
static void
|
|
parse(fp)
|
|
FILE *fp;
|
|
{
|
|
int ch, s1, s2, s3;
|
|
|
|
#define TESTD(s) { \
|
|
if ((s = getc(fp)) == EOF) \
|
|
return; \
|
|
if (!isdigit(s)) \
|
|
continue; \
|
|
}
|
|
#define TESTP { \
|
|
if ((ch = getc(fp)) == EOF) \
|
|
return; \
|
|
if (ch != '|') \
|
|
continue; \
|
|
}
|
|
#define MOVEC(t) { \
|
|
do { \
|
|
if ((ch = getc(fp)) == EOF) \
|
|
return; \
|
|
} while (ch != (t)); \
|
|
}
|
|
for (;;) {
|
|
MOVEC('"');
|
|
TESTD(s1);
|
|
TESTD(s2);
|
|
TESTD(s3);
|
|
TESTP;
|
|
putchar('"');
|
|
putchar(s1);
|
|
putchar(s2);
|
|
putchar(s3);
|
|
putchar('|');
|
|
for (;;) { /* dump to end quote. */
|
|
if ((ch = getc(fp)) == EOF)
|
|
return;
|
|
putchar(ch);
|
|
if (ch == '"')
|
|
break;
|
|
if (ch == '\\') {
|
|
if ((ch = getc(fp)) == EOF)
|
|
return;
|
|
putchar(ch);
|
|
}
|
|
}
|
|
putchar('\n');
|
|
}
|
|
}
|
|
|
|
int
|
|
main(argc, argv)
|
|
int argc;
|
|
char *argv[];
|
|
{
|
|
FILE *fp;
|
|
|
|
for (; *argv != NULL; ++argv) {
|
|
if ((fp = fopen(*argv, "r")) == NULL) {
|
|
perror(*argv);
|
|
exit (1);
|
|
}
|
|
parse(fp);
|
|
(void)fclose(fp);
|
|
}
|
|
exit (0);
|
|
}
|