|
|||
|
|||
|
#include "inspstring.h"Include dependency graph for inspstring.cpp:

Go to the source code of this file.
Functions | |
| CoreExport size_t | strlcat (char *dst, const char *src, size_t siz) |
| CoreExport size_t | strlcpy (char *dst, const char *src, size_t siz) |
| CoreExport int | charlcat (char *x, char y, int z) |
| charlcat() will append one character to a string using the same safety scemantics as strlcat(). | |
| CoreExport bool | charremove (char *mp, char remove) |
| charremove() will remove all instances of a character from a string | |
|
||||||||||||||||
|
charlcat() will append one character to a string using the same safety scemantics as strlcat().
Definition at line 102 of file inspstring.cpp. Referenced by chanrec::ChanModes(). 00103 { 00104 char* x__n = x; 00105 int v = 0; 00106 00107 while(*x__n++) 00108 v++; 00109 00110 if (v < z - 1) 00111 { 00112 *--x__n = y; 00113 *++x__n = 0; 00114 } 00115 00116 return v; 00117 }
|
|
||||||||||||
|
charremove() will remove all instances of a character from a string
Definition at line 119 of file inspstring.cpp. 00120 { 00121 char* mptr = mp; 00122 bool shift_down = false; 00123 00124 while (*mptr) 00125 { 00126 if (*mptr == remove) 00127 shift_down = true; 00128 00129 if (shift_down) 00130 *mptr = *(mptr+1); 00131 00132 mptr++; 00133 } 00134 00135 return shift_down; 00136 }
|
|
||||||||||||||||
|
Definition at line 44 of file inspstring.cpp. Referenced by chanrec::ChanModes(), cmd_modules::Handle(), and TreeSocket::Modules(). 00045 { 00046 char *d = dst; 00047 const char *s = src; 00048 size_t n = siz, dlen; 00049 00050 while (n-- != 0 && *d != '\0') 00051 d++; 00052 00053 dlen = d - dst; 00054 n = siz - dlen; 00055 00056 if (n == 0) 00057 return(dlen + strlen(s)); 00058 00059 while (*s != '\0') 00060 { 00061 if (n != 1) 00062 { 00063 *d++ = *s; 00064 n--; 00065 } 00066 00067 s++; 00068 } 00069 00070 *d = '\0'; 00071 return(dlen + (s - src)); /* count does not include NUL */ 00072 }
|
|
||||||||||||||||