]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspstring.cpp
Fix this so it works, passes test case. Provide a method to query for a bit and to...
[user/henk/code/inspircd.git] / src / inspstring.cpp
index c4829ffbb2a4e54bf7c851527300afc152b1883a..83f058b1846de6d78f1ec6780471f48756c02d83 100644 (file)
@@ -1,5 +1,5 @@
-#include "inspircd_config.h"
 #include "inspstring.h"
+#include <string.h>
 
 /*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -71,7 +71,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
     do
     {
       if ((*d++ = *s++) == 0)
-        break;
+       break;
     } while (--n != 0);
   }
 
@@ -87,3 +87,40 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
   return(s - src - 1); /* count does not include NUL */
 }
 #endif
+
+int charlcat(char* x,char y,int z)
+{
+       char* x__n = x;
+       int v = 0;
+
+       while(*x__n++)
+               v++;
+
+       if (v < z - 1)
+       {
+               *--x__n = y;
+               *++x__n = 0;
+       }
+
+       return v;
+}
+
+bool charremove(char* mp, char remove)
+{
+       char* mptr = mp;
+       bool shift_down = false;
+
+       while (*mptr)
+       {
+               if (*mptr == remove)
+               shift_down = true;
+
+               if (shift_down)
+                       *mptr = *(mptr+1);
+
+               mptr++;
+       }
+
+       return shift_down;
+}
+