From 2bf21d6516ed44567e9cf842b25fc30a3affc03f Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 9 Feb 2014 06:27:44 -0600 Subject: upgraded format_magic() to hopefully be more compatible and less voodoo-y. --- testing.c | 65 --------------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 testing.c (limited to 'testing.c') diff --git a/testing.c b/testing.c deleted file mode 100644 index 63c2620..0000000 --- a/testing.c +++ /dev/null @@ -1,65 +0,0 @@ -#include - -char *format_magic(char *from,char *nick,char *fmt,char *arg); - -int main(int argc,char *argv[]) { - char *o=format_magic("#default","epoch",argv[1],argv[2]); - printf("%s\n",o); - return 0; -} - -char *format_magic(char *from,char *nick,char *fmt,char *arg) { - int i; - int j; - int c=1; - for(i=0;fmt[i];i++) { - if(fmt[i] == '%') { - i++; - switch(fmt[i]) { - case 0: - printf("error! last character is a '%'!!!\n"); - exit(1); - case 'u': - case 'f': - case 's': - c++; - } - } - } - char **args=malloc((sizeof(char *)) * (c + 1)); - c=0; - for(i=0;fmt[i];i++) { - if(fmt[i] == '%') { - i++; - switch(fmt[i]) { - case 0: - printf("error! last character is a '%'!!!\n"); - exit(1); - case 'u': - args[c]=nick; - fmt[i]='s'; - c++; - break; - case 'f': - args[c]=from; - fmt[i]='s'; - c++; - break; - case 's': - args[c]=arg; - c++; - break; - } - } - } -// args[c]=0; -// for(i=0;i