diff options
author | cheapie <no-email-for-you@example.com> | 2015-08-26 02:28:37 -0400 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2015-08-26 02:28:37 -0400 |
commit | 0df279ad8735176f7bb3ffbac1971cd5bdc6572a (patch) | |
tree | c253c11f120113c44907d598cf1d65c2fea1c7e7 /4hexchat.c | |
parent | 63f28d8cb0bdb176e23d9296255cf86c4f3430c2 (diff) | |
download | sparkles-0df279ad8735176f7bb3ffbac1971cd5bdc6572a.tar sparkles-0df279ad8735176f7bb3ffbac1971cd5bdc6572a.tar.gz sparkles-0df279ad8735176f7bb3ffbac1971cd5bdc6572a.tar.bz2 sparkles-0df279ad8735176f7bb3ffbac1971cd5bdc6572a.tar.xz sparkles-0df279ad8735176f7bb3ffbac1971cd5bdc6572a.zip |
One source file for XChat and HexChat
4hexchat.c was really ugly and I'm removing the need for it. Now there's
a HEXCHAT define, and turning it on makes all the XChat API functions
aliases to the HexChat API functions
Diffstat (limited to '4hexchat.c')
-rw-r--r-- | 4hexchat.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/4hexchat.c b/4hexchat.c deleted file mode 100644 index 956a4a7..0000000 --- a/4hexchat.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main(int argc, char *argv[]) { - if(argc < 3){puts("Syntax: 4Hexchat Input Output"); return -1;} - - FILE *File = fopen(argv[1],"rb"); - if(File == NULL) { - fputs("Couldn't open file for reading",stderr); return 0; - } - fseek(File, 0, SEEK_END); - long FileSize = ftell(File); - rewind(File); - char *Buffer = (char*)malloc(sizeof(char)*FileSize); - if(Buffer == NULL) { - fclose(File); - fputs("Can't allocate memory",stderr); return 0; - } - if(FileSize != fread(Buffer,1,FileSize,File)) { - fclose(File); - fputs("Can't read from file",stderr); return 0; - } - fclose(File); - File = fopen(argv[2],"wb"); - if(File == NULL) { - fputs("Couldn't open file for writing",stderr); return 0; - } - - int i; - for(i=0;i<FileSize;i++) { - if(!memcmp(&Buffer[i], "xchat_", 6) && Buffer[i-1] != 'e') fprintf(File, "he"); - if(!memcmp(&Buffer[i], "xchat-", 6) && Buffer[i-1] != 'e') fprintf(File, "he"); - if(!memcmp(&Buffer[i], "XCHAT_", 6) && Buffer[i-1] != 'E') fprintf(File, "HE"); - fputc(Buffer[i], File); - } - fclose(File); - free(Buffer); - return 1; -} |