X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=util.c;h=cfe69a9b863e1d1a1b80825c506209b7dffc3f6c;hb=d447b5fbe067f469132cc8e02b583a55789ccb16;hp=aeb766eaa01f32d65234e84261b97d63d503efe3;hpb=776ac6910ee9db701c1cfe2ab234ae5fb96ce9db;p=wmpus diff --git a/util.c b/util.c index aeb766e..cfe69a9 100644 --- a/util.c +++ b/util.c @@ -91,6 +91,13 @@ list_t *list_find(list_t *list, void *data) } /* Misc */ +int str2num(char *str, int def) +{ + char *end = NULL; + int num = strtol(str, &end, 10); + return end && *end == '\0' ? num : def; +} + int error(char *fmt, ...) { va_list ap;