/* EnergyMech, IRC bot software Copyright (c) 1997-2018 proton This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define STRING_C #include "config.h" #include "defines.h" #include "structs.h" #include "global.h" #include "h.h" /* * callers responsibility to make sure text is not NULL */ int stringiscaps(const char *text) { int n,upper; n = upper = 0; while(text[n]) { if ((text[n] >= 'A' && text[n] <= 'Z') || (text[n] == '!')) upper += 2; n++; } return(upper >= n); } /* * returns NULL or non-zero length string * callers responsibility that src is not NULL */ char *chop(char **src) { char *tok,*cut = *src; while(*cut && *cut == ' ') cut++; if (*cut) { tok = cut; while(*cut && *cut != ' ') cut++; *src = cut; while(*cut && *cut == ' ') cut++; **src = 0; *src = cut; } else { tok = NULL; } return(tok); } /* * remove all '\0' in an array bounded by two pointers */ void unchop(char *orig, const char *rest) { for(;orig