1 #include "config.h" 2 3 #include <cstring> 4 5 /* This function lowercases the passed in string. */ 6 void lc(char *s); 7 8 /* This function behaves like malloc() only it checks to ensure that the memory 9 was actually allocated. If the allocation fails, it prints a message to 10 stderr and exits. */ 11 void *mymalloc(int size); 12 13 /* This function behaves like strdup() only it checks to ensure that the memory 14 was actually allocated. If the allocation fails, it prints a message to 15 stderr and exits. */ 16 char *mystrdup(const char *s); 17 18 /* This function returns a pointer to a statically allocated block of memory 19 that contains the string representation of the given integer */ 20 char *strnum(int num); 21 22 /* This function allocates new space for orig+increment and then returns 23 the pointer to that space with the data copied over. */ 24 char *strmem(const char *orig, int increment); 25 26 /* This function returns true if the passed in string is a channel name */ 27 extern int ischannel(const char *string); 28 29 /* This function replaces the last character of the string with a 30 0, effectively shortening the string's length by one. */ 31 extern char *chop(char *); 32 33 #ifndef HAVE_HTONS 34 /* This function switches around the two bytes in the integer */ 35 extern unsigned short htons(unsigned short n); 36 #endif 37 38 #ifndef HAVE_STRCMPI 39 /* This function does the same thing has strcmp, only in a case 40 insensitive manner. */ 41 extern int strcmpi(char *,char *); 42 #endif 43 44 /* This function does the same thing as strncmp, only in a case 45 insensitive manner. */ 46 int strncmpi(char *s, char *t, int n); 47 48 /* This function takes an argument (seperated by spaces) from the 49 first string and places it in the second, deleting it from the 50 first. */ 51 //void getarg(char *, char *); 52 53 /* Parses the given text into prefix, command, and further parameters */ 54 extern void parse(char *, char **, char **, char **, int *); 55 56