1163491Simp/* 2163491Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3163491Simp * 4163491Simp * Redistribution and use in source and binary forms, with or without 5163491Simp * modification, are permitted provided that the following conditions 6163491Simp * are met: 7163491Simp * 1. Redistributions of source code must retain the above copyright 8163491Simp * notice, this list of conditions and the following disclaimer. 9163491Simp * 2. Redistributions in binary form must reproduce the above copyright 10163491Simp * notice, this list of conditions and the following disclaimer in the 11163491Simp * documentation and/or other materials provided with the distribution. 12163491Simp * 13163491Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14163491Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15163491Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16163491Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17163491Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18163491Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19163491Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20163491Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21163491Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22163491Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23163491Simp */ 24163491Simp 25163491Simp#include <sys/cdefs.h> 26163491Simp__FBSDID("$FreeBSD$"); 27163491Simp 28185114Simp#include <fcntl.h> 29185114Simp#include <stdio.h> 30185114Simp#include <unistd.h> 31185114Simp#include "readcis.h" 32163491Simp 33185114Simpstatic void 34185114Simpscanfile(char *name) 35185114Simp{ 36185114Simp int fd; 37185125Simp struct tuple_list *tl; 38185114Simp 39185114Simp fd = open(name, O_RDONLY); 40185114Simp if (fd < 0) 41185114Simp return; 42185125Simp tl = readcis(fd); 43185125Simp if (tl) { 44185114Simp printf("Configuration data for file %s\n", 45185114Simp name); 46185125Simp dumpcis(tl); 47185125Simp freecis(tl); 48185114Simp } 49185114Simp close(fd); 50185114Simp} 51185114Simp 52163491Simpint 53163491Simpmain(int argc, char **argv) 54163491Simp{ 55185114Simp for (argc--, argv++; argc; argc--, argv++) 56185114Simp scanfile(*argv); 57185114Simp return 0; 58163491Simp} 59