diff 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
line wrap: on
line diff
--- a/subopt-helper.c	Thu Jun 16 09:03:11 2005 +0000
+++ b/subopt-helper.c	Thu Jun 16 09:08:07 2005 +0000
@@ -292,3 +292,22 @@
 
   return 0;
 }
+
+/*** little helpers */
+
+/** \brief compare the stings just as strcmp does */
+int strargcmp(strarg_t *arg, char *str) {
+  int res = strncmp(arg->str, str, arg->len);
+  if (!res && arg->len != strlen(str))
+    res = arg->len - strlen(str);
+  return res;
+}
+
+/** \brief compare the stings just as strcasecmp does */
+int strargcasecmp(strarg_t *arg, char *str) {
+  int res = strncasecmp(arg->str, str, arg->len);
+  if (!res && arg->len != strlen(str))
+    res = arg->len - strlen(str);
+  return res;
+}
+