# HG changeset patch # User Matti Hamalainen # Date 1338001266 -10800 # Node ID 35d67bd0613b26c6234bb7dd7f8bfe64f64a407b # Parent 6c990eae11b25a43bde6a939733d4704afb81b4c Move str_*() functions to util.c diff -r 6c990eae11b2 -r 35d67bd0613b main.c --- a/main.c Sat May 26 06:00:02 2012 +0300 +++ b/main.c Sat May 26 06:01:06 2012 +0300 @@ -209,36 +209,6 @@ } -BOOL str_get_timestamp(char *str, size_t len, const char *fmt) -{ - time_t stamp = time(NULL); - struct tm *stamp_tm; - if ((stamp_tm = localtime(&stamp)) != NULL) - { - strftime(str, len, fmt, stamp_tm); - return TRUE; - } - else - { - str[0] = 0; - return FALSE; - } -} - - -char * str_trim_left(char *buf) -{ - while (*buf != 0 && th_isspace(*buf)) buf++; - return buf; -} - - -int str_compare(const void *s1, const void *s2) -{ - return th_strcasecmp((const char *) s1, (const char *) s2); -} - - nn_window_t *nnwin_find(const char *id) { int i; diff -r 6c990eae11b2 -r 35d67bd0613b util.c --- a/util.c Sat May 26 06:00:02 2012 +0300 +++ b/util.c Sat May 26 06:01:06 2012 +0300 @@ -6,6 +6,36 @@ #include "util.h" +BOOL str_get_timestamp(char *str, size_t len, const char *fmt) +{ + time_t stamp = time(NULL); + struct tm *stamp_tm; + if ((stamp_tm = localtime(&stamp)) != NULL) + { + strftime(str, len, fmt, stamp_tm); + return TRUE; + } + else + { + str[0] = 0; + return FALSE; + } +} + + +char * str_trim_left(char *buf) +{ + while (*buf != 0 && th_isspace(*buf)) buf++; + return buf; +} + + +int str_compare(const void *s1, const void *s2) +{ + return th_strcasecmp((const char *) s1, (const char *) s2); +} + + #define PUSHCHAR(x) th_vputch(&result, &resSize, &resPos, x) #define PUSHSTR(x) th_vputs(&result, &resSize, &resPos, x) diff -r 6c990eae11b2 -r 35d67bd0613b util.h --- a/util.h Sat May 26 06:00:02 2012 +0300 +++ b/util.h Sat May 26 06:01:06 2012 +0300 @@ -98,4 +98,9 @@ nn_strtuple_t *nn_strtuple_new(size_t, char *); void nn_strtuple_free(nn_strtuple_t *); + +BOOL str_get_timestamp(char *str, size_t len, const char *fmt); +char * str_trim_left(char *buf); +int str_compare(const void *s1, const void *s2); + #endif