comparison subopt-helper.c @ 15734:7e4fa8fc255c

helper functions for comparing strarg_t "strings".
author reimar
date Thu, 16 Jun 2005 09:08:07 +0000
parents e678e306068e
children 061d6e09ad62
comparison
equal deleted inserted replaced
15733:e678e306068e 15734:7e4fa8fc255c
290 { 290 {
291 if ( *i > 0 ) { return 1; } 291 if ( *i > 0 ) { return 1; }
292 292
293 return 0; 293 return 0;
294 } 294 }
295
296 /*** little helpers */
297
298 /** \brief compare the stings just as strcmp does */
299 int strargcmp(strarg_t *arg, char *str) {
300 int res = strncmp(arg->str, str, arg->len);
301 if (!res && arg->len != strlen(str))
302 res = arg->len - strlen(str);
303 return res;
304 }
305
306 /** \brief compare the stings just as strcasecmp does */
307 int strargcasecmp(strarg_t *arg, char *str) {
308 int res = strncasecmp(arg->str, str, arg->len);
309 if (!res && arg->len != strlen(str))
310 res = arg->len - strlen(str);
311 return res;
312 }
313