Over 25% decrease in file size for large logs.

Fixed bug with '<','>', and '&' characters.
main
Nichole Mattera 14 years ago
parent 7fe506355f
commit 3556611fbc
  1. 4
      JALOG_CONV.dev
  2. 6
      JALOG_CONV_private.h
  3. 4
      JALOG_CONV_private.rc
  4. BIN
      JALOG_CONV_private.res
  5. 46
      main.c

@ -41,9 +41,9 @@ BuildCmd=
[VersionInfo]
Major=1
Minor=0
Minor=1
Release=0
Build=84
Build=88
LanguageID=1033
CharsetID=1252
CompanyName=Steven Mattera

@ -5,11 +5,11 @@
#define JALOG_CONV_PRIVATE_H
/* VERSION DEFINITIONS */
#define VER_STRING "1.0.0.84"
#define VER_STRING "1.1.0.89"
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_MINOR 1
#define VER_RELEASE 0
#define VER_BUILD 84
#define VER_BUILD 89
#define COMPANY_NAME "Steven Mattera"
#define FILE_VERSION "1.0"
#define FILE_DESCRIPTION ""

@ -10,8 +10,8 @@ A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "JALOG_CONV.ico"
// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS...
//
1 VERSIONINFO
FILEVERSION 1,0,0,84
PRODUCTVERSION 1,0,0,84
FILEVERSION 1,1,0,89
PRODUCTVERSION 1,1,0,89
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"

Binary file not shown.

@ -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("&lt;", convFile);
}
else if (line[n] == '>') {
fputs("&gt;", convFile);
}
else if (line[n] == '&') {
fputs("&amp;", 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);

Loading…
Cancel
Save