]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspstring.cpp
Tweaks to backwards memcpy's that dont actually do anything, causing ipv6 address...
[user/henk/code/inspircd.git] / src / inspstring.cpp
index 4f1875b8c870ee728d86c254ac832b2c6508a7f8..d8df39e1883f9d4fd95b77a20c22a27fa395a0b0 100644 (file)
@@ -1,8 +1,18 @@
-#include "inspircd_config.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
 #include "inspstring.h"
-#include <cstddef>
 #include <string.h>
-#include <stdio.h>
 
 /*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -74,7 +84,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
     do
     {
       if ((*d++ = *s++) == 0)
-        break;
+       break;
     } while (--n != 0);
   }
 
@@ -90,3 +100,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;
+}
+