www.pudn.com > openwebspiderv0.1a.zip > strfnct.h
/* OpenWebSpider * * Coded by Shen139 * shen139 [at] eviltime (dot) com * * * This file is part of OpenWebSpider * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __STRFNCT #define __STRFNCT #include#include /* atoupper * in -> out <- maxout -> * in = "HellO" => out = "HELLO" */ int atoupper(char* in, char* out, int maxout) { int i,m; char *midOut; midOut=malloc(maxout+1); memset(midOut,0,maxout); m=MIN((signed)strlen(in),maxout); for(i=0;i Tokens -> out <- len -> * str = "test1\n2\r3;!4" Tokens = "\n\r;" ==> out = "test123!4" */ int UnToken(char* str,char* Tokens,char* out,int len) { int c,i,x=0,tokenfound,y; y=MIN(len,(signed)strlen(str)); for(c=0;c Tokens -> len -> 1|0 <- * str = "test1\n2\r3;!4" Tokens = "\n\r;" ==> 1 */ int bTokenIn(char* str,char* Tokens,int len) { int c,i,y; y=MIN(len,(signed)strlen(str)); for(c=0;c out <- len -> * str = "test1 2 4 4" out = "test1 2 4 4" */ int OnlyOneSpace(char* str,char* out,int len) { int c,x=0,space=0; for(c=0;c<(signed)strlen(str);c++) { if(space==0 && str[c]==' ') { out[x++]=str[c]; space=1; } if(space==1 && str[c]==' ') space=1; if(str[c]!=' ') space=0; if(space==0) out[x++]=str[c]; if(x>=len) break; } out[x]=0; return 1; } int ReplaceChr(char* string, char bus, char sub) { int i; for(i=0;i<(signed)strlen(string);i++) { if(string[i]==bus) string[i]=sub; } return 1; } #endif