2 * oconfig - src/oconfig.c
3 * Copyright (C) 2006,2007 Florian octo Forster <octo at verplant.org>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 oconfig_item_t *ci_root;
31 static void yyset_in (FILE *fd)
36 oconfig_item_t *oconfig_parse_fh (FILE *fh)
46 fprintf (stderr, "yyparse returned error #%i\n", status);
52 yyset_in ((FILE *) 0);
55 } /* oconfig_item_t *oconfig_parse_fh */
57 oconfig_item_t *oconfig_parse_file (const char *file)
62 fh = fopen (file, "r");
65 fprintf (stderr, "fopen (%s) failed: %s\n", file, strerror (errno));
69 ret = oconfig_parse_fh (fh);
73 } /* oconfig_item_t *oconfig_parse_file */
75 void oconfig_free (oconfig_item_t *ci)
79 if (ci->values != NULL)
82 for (i = 0; i < ci->children_num; i++)
83 oconfig_free (ci->children + i);
87 * vim:shiftwidth=2:tabstop=8:softtabstop=2