From: Steve Dickson Date: Wed, 5 Aug 2009 19:53:36 +0000 (-0400) Subject: Make Section names case-insensitive which should X-Git-Tag: nfs-utils-1-2-1-rc4~9 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=c6a270ea8ab6ad299e6a43445420f22e0c617e3e;p=nfs-utils.git Make Section names case-insensitive which should help in locating them resulting in make the config files a bit less error prone Signed-off-by: Steve Dickson --- diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c index 5f491eb..a8b8037 100644 --- a/support/nfs/conffile.c +++ b/support/nfs/conffile.c @@ -115,6 +115,18 @@ conf_hash(char *s) return hash; } +/* + * Convert letter from upper case to lower case + */ +static inline void upper2lower(char *str) +{ + char *ptr = str; + + while (*ptr) + *ptr++ = tolower(*ptr); +} + + /* * Insert a tag-value combination from LINE (the equal sign is at POS) */ @@ -654,6 +666,9 @@ conf_set(int transaction, char *section, char *tag, xlog_warn("conf_set: strdup(\"%s\") failed", section); goto fail; } + /* Make Section names case-insensitive */ + upper2lower(node->section); + node->tag = strdup(tag); if (!node->tag) { xlog_warn("conf_set: strdup(\"%s\") failed", tag);