From d03d6e606b40157d910ddf99ab018156abeb8ef0 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 28 Feb 2011 18:59:32 +0100 Subject: add wdk changes to named branch --- plugins/mpcinfo/functions.c | 167 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 plugins/mpcinfo/functions.c (limited to 'plugins/mpcinfo/functions.c') diff --git a/plugins/mpcinfo/functions.c b/plugins/mpcinfo/functions.c new file mode 100644 index 00000000..ed0632d4 --- /dev/null +++ b/plugins/mpcinfo/functions.c @@ -0,0 +1,167 @@ +/* + * 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. + */ + +/* +typedef int (*MYPROC)(HWND,HWND,char*,char*,BOOL,BOOL); + +int dllProc(char *name, char *data){ + HINSTANCE hinstLib; + hinstLib = LoadLibrary("mpcinfo"); + //MYPROC proc; + int res; + if (hinstLib != NULL){ + //proc = ; + if ((MYPROC) GetProcAddress(hinstLib, name)!=NULL){ + res=(MYPROC)(NULL,NULL,data,NULL,TRUE,TRUE); + } + else{fprintf(stderr,"can't get proc: %s\n",name);res=-2;} + } + else{fprintf(stderr,"can't access dll\n");return -1;} + FreeLibrary(hinstLib); + return res; +} +*/ + +/* +int dllProc(char *name, char *data) +{ + static HMODULE lib = NULL; + if (!lib) + { + lib = LoadLibraryA ("mpcinfo"); + if (!lib) + { + return FALSE; + } + FreeLibrary (lib); + } + + return TRUE; +} +*/ + +char *split(char *text, char seperator){ + //if (DEBUG==1) putlog("splitting"); + int i;int pos=-1; + for (i=0;i=0;i--){ + if (ret[i]==32) ret[i]=0; + else i=-1; + } + } + //if (DEBUG==1) putlog("substring created"); + return ret; +} + +static char *substring(char *text, int first, int length){return subString(text,first,length,0);} + + +char *readLine(FILE *f){ + //if (DEBUG==1) putlog("reading line from file"); + char *buffer=(char*)calloc(1024,sizeof(char)); //malloc(sizeof(char)*1024); + int pos=0; + int cc=0; + while((cc!=EOF)&&(pos<1024)&&(cc!=10)){ + cc=fgetc(f); + if ((cc!=10)&&(cc!=13)){ + if (cc==EOF) buffer[pos]=0; + else buffer[pos]=(char)cc;pos++; + } + } + if (buffer[pos]==EOF) xchat_printf(ph,"EOF: %i\n",pos); + return buffer; +} + +char *toUpper(char *text){ + //if (DEBUG==1) putlog("converting text to upper case"); + char *ret=(char*) calloc(strlen(text)+1,sizeof(char)); + int i; + for (i=0;i