summaryrefslogtreecommitdiffstats
path: root/subopt-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'subopt-helper.c')
-rw-r--r--subopt-helper.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/subopt-helper.c b/subopt-helper.c
index 0356e036c4..9ae6669a05 100644
--- a/subopt-helper.c
+++ b/subopt-helper.c
@@ -292,3 +292,22 @@ int int_pos( int * i )
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;
+}
+