]> git.draconx.ca Git - gob-dx.git/blobdiff - src/util.c
Convert command-line options processing to getopt_long.
[gob-dx.git] / src / util.c
index 4d424402cfd651ef259f60408e37f580ed7f505f..d040ee44a15749ff8950954c8e6f4b7f4f1652b7 100644 (file)
@@ -20,7 +20,7 @@
  * USA.
  */
 
-#include "config.h"
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -81,13 +81,17 @@ remove_sep(const char *base)
 {
        char *p;
        char *s = g_strdup(base);
+       char *q=s;
 
        /* don't eat C++ :: thingies */
        if (for_cpp && strstr (s, "::") != NULL)
                return s;
 
-       while((p = strchr(s, ':')))
-               strcpy(p, p+1);
+       for(p=(char *)base;*p;p++){
+               if (*p!=':')
+                       *q++=*p;
+       }
+       *q='\0';
        return s;
 }
 
@@ -403,6 +407,31 @@ gob_strdown (char *str)
        return str;
 }
 
+int
+gob_strcasecmp(const char *s1, const char *s2)
+{
+       return g_ascii_strcasecmp(s1, s2);
+}
+
+char *
+gob_str_delete_quotes(char *str)
+{
+       char *p, *i;
+       p=i=str;
+       while(*p!='\0')
+       {
+               if(*p=='\"')
+               {
+                       p++;
+                       continue;
+               }
+               *i=*p;
+               p++; i++;
+       }
+       *i=*p;
+       return str;
+}
+
 char *
 make_me_type (const char *type, const char *alt)
 {