]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Fix the --log_color option of para_server and para_audiod.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 20:55:20 +0000 (22:55 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 20:55:20 +0000 (22:55 +0200)
NEWS
string.c

diff --git a/NEWS b/NEWS
index e51de1b7ad21e0170c561702130cf8346e886447..20e5105ffa763a873f31e63c2c1c1644caf67991 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ NEWS
        - the new prebuffer filter
        - improved signal handling
        - variable fec output buffer size
+       - --log_color actually works
 
 -----------------------------------------
 0.3.4 (2009-05-07) "elliptic inheritance"
index 52003c4b49035c0075ff1ef51de150c4f9542379..e037ebb49c75f9a38c42e7699090253a55bef74d 100644 (file)
--- a/string.c
+++ b/string.c
@@ -587,6 +587,11 @@ int para_atoi32(const char *str, int32_t *value)
        return 1;
 }
 
+static inline int loglevel_equal(const char *arg, const char * const ll)
+{
+       return !strncasecmp(arg, ll, strlen(ll));
+}
+
 /**
  * Compute the loglevel number from its name.
  *
@@ -596,19 +601,19 @@ int para_atoi32(const char *str, int32_t *value)
  */
 int get_loglevel_by_name(const char *txt)
 {
-       if (!strcasecmp(txt, "debug"))
+       if (loglevel_equal(txt, "debug"))
                return LL_DEBUG;
-       if (!strcasecmp(txt, "info"))
+       if (loglevel_equal(txt, "info"))
                return LL_INFO;
-       if (!strcasecmp(txt, "notice"))
+       if (loglevel_equal(txt, "notice"))
                return LL_NOTICE;
-       if (!strcasecmp(txt, "warning"))
+       if (loglevel_equal(txt, "warning"))
                return LL_WARNING;
-       if (!strcasecmp(txt, "error"))
+       if (loglevel_equal(txt, "error"))
                return LL_ERROR;
-       if (!strcasecmp(txt, "crit"))
+       if (loglevel_equal(txt, "crit"))
                return LL_CRIT;
-       if (!strcasecmp(txt, "emerg"))
+       if (loglevel_equal(txt, "emerg"))
                return LL_EMERG;
        return -1;
 }