|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
// main.c
|
|
|
|
|
// Jedi Academy Server Log Converter - Version 1.0
|
|
|
|
|
// Jedi Academy Server Log Converter - Version 1.1
|
|
|
|
|
//
|
|
|
|
|
// Created By Steven Mattera on August 30th 2010.
|
|
|
|
|
// Copyright (c) 2010 Steven Mattera <stevenmattera@gmail.com>
|
|
|
|
@ -60,7 +60,7 @@ int main(int argc, char *argv[]) { |
|
|
|
|
convFile = openConvFile(argv); |
|
|
|
|
if (convFile == NULL) return -1; |
|
|
|
|
|
|
|
|
|
fputs("<HTML>\n<BODY BGCOLOR='GRAY'>\n<FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("<html><head><style>body{background-color:gray}b{font-weight:normal}.r{color:red}.g{color:green}.y{color:yellow}.b{color:blue}.c{color:cyan}.m{color:magenta}.w{color:white}.l{color:black}</style></head><body><span class='w'>", convFile); |
|
|
|
|
|
|
|
|
|
char * line; |
|
|
|
|
char * lineProcessing; |
|
|
|
@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
|
|
fgets(line, 512, logFile); |
|
|
|
|
if(color != 7) { |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class=w>", convFile); |
|
|
|
|
color = 7; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -85,49 +85,49 @@ int main(int argc, char *argv[]) { |
|
|
|
|
case 1: |
|
|
|
|
if(color != 1) { |
|
|
|
|
color = 1; |
|
|
|
|
fputs("</FONT><FONT COLOR='RED'>", convFile); |
|
|
|
|
fputs("</b><b class='r'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
if(color != 2) { |
|
|
|
|
color = 2; |
|
|
|
|
fputs("</FONT><FONT COLOR='GREEN'>", convFile); |
|
|
|
|
fputs("</b><b class='g'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
if(color != 3) { |
|
|
|
|
color = 3; |
|
|
|
|
fputs("</FONT><FONT COLOR='YELLOW'>", convFile); |
|
|
|
|
fputs("</b><b class=y'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
if(color != 4) { |
|
|
|
|
color = 4; |
|
|
|
|
fputs("</FONT><FONT COLOR='BLUE'>", convFile); |
|
|
|
|
fputs("</b><b class='b'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
if(color != 5) { |
|
|
|
|
color = 5; |
|
|
|
|
fputs("</FONT><FONT COLOR='CYAN'>", convFile); |
|
|
|
|
fputs("</b><b class='c'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
if(color != 6) { |
|
|
|
|
color = 6; |
|
|
|
|
fputs("</FONT><FONT COLOR='PURPLE'>", convFile); |
|
|
|
|
fputs("</b><b class='m'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 7: |
|
|
|
|
if(color != 7) { |
|
|
|
|
color = 7; |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class='w'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 0: |
|
|
|
|
if(color != 8) { |
|
|
|
|
color = 8; |
|
|
|
|
fputs("</FONT><FONT COLOR='BLACK'>", convFile); |
|
|
|
|
fputs("</b><b class='l'>", convFile); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
@ -138,33 +138,41 @@ int main(int argc, char *argv[]) { |
|
|
|
|
n++; |
|
|
|
|
} |
|
|
|
|
else if (line[n] == ':' && color != 7) { |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class='w'>", convFile); |
|
|
|
|
fputc(':', convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] == '\\' && color != 7) { |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class='w'>", convFile); |
|
|
|
|
fputc('\\', convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] == ' ' && line[n+1] == 'k' && line[n+2] == 'i' && line[n+3] == 'l' && line[n+4] == 'l' && line[n+5] == 'e' && line[n+6] == 'd' && line[n+7] == ' ' && color != 7) { |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class='w'>", convFile); |
|
|
|
|
fputc(' ', convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] == ' ' && line[n+1] == 'b' && line[n+2] == 'y' && line[n+3] == ' ' && color != 7) { |
|
|
|
|
fputs("</FONT><FONT COLOR='WHITE'>", convFile); |
|
|
|
|
fputs("</b><b class='w'>", convFile); |
|
|
|
|
fputc(' ', convFile); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
else if (line[n] == '<') { |
|
|
|
|
fputs("<", convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] == '>') { |
|
|
|
|
fputs(">", convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] == '&') { |
|
|
|
|
fputs("&", convFile); |
|
|
|
|
} |
|
|
|
|
else if (line[n] != '\n' || line[n] != '\r') { |
|
|
|
|
fputc(line[n], convFile); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fputs("<BR>\n", convFile); |
|
|
|
|
fputs("<br>", convFile); |
|
|
|
|
|
|
|
|
|
free(line); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fputs("</BODY>\n", convFile); |
|
|
|
|
fputs("</HTML>", convFile); |
|
|
|
|
fputs("</body></html>", convFile); |
|
|
|
|
|
|
|
|
|
fclose(convFile); |
|
|
|
|
fclose(logFile); |
|
|
|
|