diff --git a/usr.sbin/dumpcis/Makefile b/usr.sbin/dumpcis/Makefile index 607c0fba886e..283de3a58387 100644 --- a/usr.sbin/dumpcis/Makefile +++ b/usr.sbin/dumpcis/Makefile @@ -4,7 +4,7 @@ PROG= dumpcis MAN= dumpcis.8 -SRCS= main.c dumpcis.c dumpcisfile.c readcis.c printcis.c +SRCS= main.c readcis.c printcis.c WARNS?= 5 .include diff --git a/usr.sbin/dumpcis/dumpcis.c b/usr.sbin/dumpcis/dumpcis.c deleted file mode 100644 index 9b89f2b6af0e..000000000000 --- a/usr.sbin/dumpcis/dumpcis.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "readcis.h" - -void -dump(unsigned char *p, int sz) -{ - int ad = 0, i; - - while (sz > 0) { - printf("%03x: ", ad); - for (i = 0; i < ((sz < 16) ? sz : 16); i++) - printf(" %02x", p[i]); - printf("\n"); - sz -= 16; - p += 16; - ad += 16; - } -} diff --git a/usr.sbin/dumpcis/dumpcisfile.c b/usr.sbin/dumpcis/dumpcisfile.c deleted file mode 100644 index d8146a815491..000000000000 --- a/usr.sbin/dumpcis/dumpcisfile.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "readcis.h" - -static void -scanfile(char *name) -{ - int fd; - struct cis *cp; - - fd = open(name, O_RDONLY); - if (fd < 0) - return; - cp = readcis(fd); - if (cp) { - printf("Configuration data for file %s\n", - name); - dumpcis(cp); - freecis(cp); - } - close(fd); -} - -int -dumpcisfile_main(int argc, char **argv) -{ - - isdumpcisfile = 1; - for (argc--, argv++; argc; argc--, argv++) - scanfile(*argv); - return 0; -} diff --git a/usr.sbin/dumpcis/main.c b/usr.sbin/dumpcis/main.c index 317195c1f8e1..d721b0af65ac 100644 --- a/usr.sbin/dumpcis/main.c +++ b/usr.sbin/dumpcis/main.c @@ -25,10 +25,50 @@ #include __FBSDID("$FreeBSD$"); -int dumpcisfile_main(int, char **); +#include +#include +#include +#include "readcis.h" + +void +dump(unsigned char *p, int sz) +{ + int ad = 0, i; + + while (sz > 0) { + printf("%03x: ", ad); + for (i = 0; i < ((sz < 16) ? sz : 16); i++) + printf(" %02x", p[i]); + printf("\n"); + sz -= 16; + p += 16; + ad += 16; + } +} + +static void +scanfile(char *name) +{ + int fd; + struct cis *cp; + + fd = open(name, O_RDONLY); + if (fd < 0) + return; + cp = readcis(fd); + if (cp) { + printf("Configuration data for file %s\n", + name); + dumpcis(cp); + freecis(cp); + } + close(fd); +} int main(int argc, char **argv) { - return dumpcisfile_main(argc, argv); + for (argc--, argv++; argc; argc--, argv++) + scanfile(*argv); + return 0; } diff --git a/usr.sbin/dumpcis/readcis.h b/usr.sbin/dumpcis/readcis.h index 00d12e4be8b9..4551c9e503a5 100644 --- a/usr.sbin/dumpcis/readcis.h +++ b/usr.sbin/dumpcis/readcis.h @@ -144,5 +144,3 @@ struct cis *readcis(int); const char *tuple_name(unsigned char); u_int parse_num(int, u_char *, u_char **, int); - -int isdumpcisfile;