From owner-svn-src-head@FreeBSD.ORG Thu Nov 20 03:30:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AC2B1065675; Thu, 20 Nov 2008 03:30:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2B88FC16; Thu, 20 Nov 2008 03:30:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAK3URXn037729; Thu, 20 Nov 2008 03:30:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAK3UR95037726; Thu, 20 Nov 2008 03:30:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811200330.mAK3UR95037726@svn.freebsd.org> From: Warner Losh Date: Thu, 20 Nov 2008 03:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185114 - head/usr.sbin/dumpcis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Nov 2008 03:30:28 -0000 Author: imp Date: Thu Nov 20 03:30:27 2008 New Revision: 185114 URL: http://svn.freebsd.org/changeset/base/185114 Log: Simplify: move dumpcis.c and dumpcisfile.c into main. Deleted: head/usr.sbin/dumpcis/dumpcis.c head/usr.sbin/dumpcis/dumpcisfile.c Modified: head/usr.sbin/dumpcis/Makefile head/usr.sbin/dumpcis/main.c head/usr.sbin/dumpcis/readcis.h Modified: head/usr.sbin/dumpcis/Makefile ============================================================================== --- head/usr.sbin/dumpcis/Makefile Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/Makefile Thu Nov 20 03:30:27 2008 (r185114) @@ -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 Modified: head/usr.sbin/dumpcis/main.c ============================================================================== --- head/usr.sbin/dumpcis/main.c Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/main.c Thu Nov 20 03:30:27 2008 (r185114) @@ -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; } Modified: head/usr.sbin/dumpcis/readcis.h ============================================================================== --- head/usr.sbin/dumpcis/readcis.h Thu Nov 20 02:06:05 2008 (r185113) +++ head/usr.sbin/dumpcis/readcis.h Thu Nov 20 03:30:27 2008 (r185114) @@ -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;