-oconfig_item_t *oconfig_parse_fh (FILE *fh);
-oconfig_item_t *oconfig_parse_file (const char *file);
+/* Functions provided by the scanner */
+void yyset_in (FILE *);
+
+oconfig_item_t *ci_root;
+
+oconfig_item_t *oconfig_parse_fh (FILE *fh)
+{
+ int status;
+ oconfig_item_t *ret;
+
+ yyset_in (fh);
+
+ status = yyparse ();
+ if (status != 0)
+ {
+ fprintf (stderr, "yyparse returned error #%i\n", status);
+ return (NULL);
+ }
+
+ ret = ci_root;
+ ci_root = NULL;
+ yyset_in ((FILE *) 0);
+
+ return (ret);
+} /* oconfig_item_t *oconfig_parse_fh */
+
+oconfig_item_t *oconfig_parse_file (const char *file)
+{
+ FILE *fh;
+ oconfig_item_t *ret;
+
+ fh = fopen (file, "r");
+ if (fh == NULL)
+ {
+ fprintf (stderr, "fopen (%s) failed: %s\n", file, strerror (errno));
+ return (NULL);
+ }
+
+ ret = oconfig_parse_fh (fh);
+ fclose (fh);
+
+ return (ret);
+} /* oconfig_item_t *oconfig_parse_file */