X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=string.c;h=3c80d27cc6b6ad73a95392c17cdb041837ec6ba5;hp=bdc113d3586c63059311968275f6134f5a9037b9;hb=2b3cc3af64d5574473c2f1ea9c32d7589abbb811;hpb=40de1dd2fdbb054444d585aa70e2d50166a66e07 diff --git a/string.c b/string.c index bdc113d3..3c80d27c 100644 --- a/string.c +++ b/string.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Andre Noll + * Copyright (C) 2004-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -586,3 +586,22 @@ int para_atoi32(const char *str, int32_t *value) *value = tmp; return 1; } + +int get_loglevel_by_name(const char *txt) +{ + if (!strcasecmp(txt, "debug")) + return LL_DEBUG; + if (!strcasecmp(txt, "info")) + return LL_INFO; + if (!strcasecmp(txt, "notice")) + return LL_NOTICE; + if (!strcasecmp(txt, "warning")) + return LL_WARNING; + if (!strcasecmp(txt, "error")) + return LL_ERROR; + if (!strcasecmp(txt, "crit")) + return LL_CRIT; + if (!strcasecmp(txt, "emerg")) + return LL_EMERG; + return -1; +}