1 /* Simple Config file API 2 * Dave Eckhardt 3 * Rob Siemborski 4 * Tim Martin (originally in Cyrus distribution) 5 */ 6 /* 7 * Copyright (c) 2001-2016 Carnegie Mellon University. All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in 18 * the documentation and/or other materials provided with the 19 * distribution. 20 * 21 * 3. The name "Carnegie Mellon University" must not be used to 22 * endorse or promote products derived from this software without 23 * prior written permission. For permission or any other legal 24 * details, please contact 25 * Carnegie Mellon University 26 * Center for Technology Transfer and Enterprise Creation 27 * 4615 Forbes Avenue 28 * Suite 302 29 * Pittsburgh, PA 15213 30 * (412) 268-7393, fax: (412) 268-7395 31 * innovation@andrew.cmu.edu 32 * 33 * 4. Redistributions of any form whatsoever must retain the following 34 * acknowledgment: 35 * "This product includes software developed by Computing Services 36 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 37 * 38 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 39 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 40 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 41 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 42 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 43 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 44 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 45 */ 46 47 struct cfile; /* cc can type check, nobody can look inside */ 48 49 typedef struct cfile *cfile; 50 51 cfile cfile_read(const char *filename, char *complaint, int complaint_len); 52 const char *cfile_getstring(cfile cf,const char *key,const char *def); 53 int cfile_getint(cfile cf,const char *key,int def); 54 int cfile_getswitch(cfile cf,const char *key,int def); 55 void cfile_free(cfile cf); 56