Accept lowercase common log formats
This commit makes the string comparison for log formats case insensitve,
so that user can indifferently use eg. `--log-format=COMBINED` or
`--log-format=combined` when they set the log format.
Closes:
@@ -325,12 +325,25 @@ parse_conf_file (int *argc, char ***argv) {
}
/* Get the enumerated log format given its equivalent format string.
+ * The case in the format string does not matter.
*
* On error, -1 is returned.
* On success, the enumerated format is returned. */
static int
get_log_format_item_enum (const char *str) {
- return str2enum (LOGTYPE, ARRAY_SIZE (LOGTYPE), str);
+ int ret;
+ char *upstr;
+
+ ret = str2enum (LOGTYPE, ARRAY_SIZE (LOGTYPE), str);
+ if (ret >= 0)
+ return ret;
+
+ /* uppercase the input string and try again */
+ upstr = strtoupper (xstrdup (str));
+ ret = str2enum (LOGTYPE, ARRAY_SIZE (LOGTYPE), upstr);
+ free (upstr);
+
+ return ret;
}
/* Determine the selected log format from the config file or command line
