1 /* cfg.h - Configuration file parser
3 * Copyright 1992-1998 Werner Almesberger
4 * Copyright 1999-2007 John Coffman
5 * Copyright 2009-2011 Joachim Wiedorn
8 * Licensed under the terms contained in the file 'COPYING'
9 * in the source directory.
15 typedef enum { cft_strg,cft_flag,cft_link,cft_end } CONFIG_TYPE;
25 #define RAID_EXTRA_BOOT "raid-extra-boot"
27 extern CONFIG cf_top[],cf_identify[],cf_options[],cf_all[],cf_kernel[],
28 cf_image[],cf_other[],cf_disk[],cf_partitions[],cf_partition[],
29 cf_map_drive[],cf_change_rules[],cf_change_rule[],cf_change[],
30 cf_change_dsc[],cf_bitmap[];
35 int cfg_open(char *name);
37 /* Opens the configuration file. Returns the file descriptor of the open
40 void cfg_error(char *msg,...) __attribute__ ((format (printf, 1, 2)));
42 /* Signals an error while parsing the configuration file and terminates the
45 void cfg_init(CONFIG *table);
47 /* Initializes the specified table. */
49 void cfg_set(CONFIG *table,char *item,char *value,void *context);
51 /* Sets the specified variable in table. If the variable has already been set
52 since the last call to cfg_init, a warning message is issued if the context
53 keys don't match or a fatal error is reported if they do. */
55 void cfg_unset(CONFIG *table,char *item);
57 /* Unsets the specified variable in table. It is a fatal error if the variable
60 int cfg_parse(CONFIG *table);
62 /* Parses the configuration file for variables contained in table. A non-zero
63 value is returned if a variable not found in table has been met. Zero is
64 returned if EOF has been reached. */
66 int cfg_get_flag(CONFIG *table,char *item);
68 /* Returns one if the specified variable is set, zero if it isn't. */
70 char *cfg_get_strg(CONFIG *table,char *item);
72 /* Returns the value of the specified variable if it is set, NULL otherwise. */
75 FILE *cfg_pw_open(void);
76 /* open the password file, creating a new file if passw is set. */
78 void cfg_bitmap_only(void);
79 /* allow only the "bitmap" keywords */
82 void cfg_alpha_check(void);
83 /* check for tables in alphabetical order */