comparison main.c @ 464:35d67bd0613b

Move str_*() functions to util.c
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 26 May 2012 06:01:06 +0300
parents c956af023014
children 796508f828f6
comparison
equal deleted inserted replaced
463:6c990eae11b2 464:35d67bd0613b
204 THERR("Username '%s' already specified on commandline!\n", optUserNameCmd); 204 THERR("Username '%s' already specified on commandline!\n", optUserNameCmd);
205 return FALSE; 205 return FALSE;
206 } 206 }
207 207
208 return TRUE; 208 return TRUE;
209 }
210
211
212 BOOL str_get_timestamp(char *str, size_t len, const char *fmt)
213 {
214 time_t stamp = time(NULL);
215 struct tm *stamp_tm;
216 if ((stamp_tm = localtime(&stamp)) != NULL)
217 {
218 strftime(str, len, fmt, stamp_tm);
219 return TRUE;
220 }
221 else
222 {
223 str[0] = 0;
224 return FALSE;
225 }
226 }
227
228
229 char * str_trim_left(char *buf)
230 {
231 while (*buf != 0 && th_isspace(*buf)) buf++;
232 return buf;
233 }
234
235
236 int str_compare(const void *s1, const void *s2)
237 {
238 return th_strcasecmp((const char *) s1, (const char *) s2);
239 } 209 }
240 210
241 211
242 nn_window_t *nnwin_find(const char *id) 212 nn_window_t *nnwin_find(const char *id)
243 { 213 {