? "unicode" : "ascii");
enum { BOX_ASCII, BOX_UNICODE } box = parse_enum (opt (o, "box", default_box),
"ascii", BOX_ASCII,
- "unicode", BOX_UNICODE,
- NULL_SENTINEL);
+ "unicode", BOX_UNICODE);
static const struct render_ops ascii_render_ops = {
.draw_line = ascii_draw_line,
if (file_name == NULL)
file_name = xstrdup (f->default_file_name);
- /* XXX should use parse_enum(). */
enum settings_output_devices default_type = default_device_type (file_name);
const char *default_type_string = (default_type == SETTINGS_DEVICE_TERMINAL
? "terminal" : "listing");
O has no user-specified value, then O's default value is treated the same
way. If the default value still does not match, parse_enum() returns 0.
- Example: parse_enum (o, "a", 1, "b", 2, NULL_SENTINEL) returns 1 if O's
- value if "a", 2 if O's value is "b". */
+ Example: parse_enum (o, "a", 1, "b", 2) returns 1 if O's value if "a", 2 if
+ O's value is "b". */
int
-parse_enum (struct driver_option o, ...)
+(parse_enum) (struct driver_option o, ...)
{
va_list args;
va_start (args, o);
void parse_paper_size (struct driver_option, int *h, int *v);
bool parse_boolean (struct driver_option);
+
int parse_enum (struct driver_option, ...) SENTINEL(0);
+#define parse_enum(...) parse_enum(__VA_ARGS__, NULL_SENTINEL)
+
int parse_int (struct driver_option, int min_value, int max_value);
int parse_dimension (struct driver_option);
char *parse_string (struct driver_option);