2014-03-30 17:51:53 +04:00
|
|
|
enum { TAG, OPTION_VALUE, TEXT, COMMENT };
|
|
|
|
|
2014-03-30 15:57:13 +04:00
|
|
|
//you are butifull, you are butifull
|
|
|
|
dword ShowSource()
|
|
|
|
{
|
|
|
|
dword new_buf, new_buf_start, i;
|
2014-03-30 17:51:53 +04:00
|
|
|
byte ww, mode;
|
2014-03-30 15:57:13 +04:00
|
|
|
|
|
|
|
if (souce_mode) return;
|
|
|
|
souce_mode = true;
|
2014-03-31 21:14:16 +04:00
|
|
|
new_buf = malloc(bufsize*5);
|
|
|
|
new_buf_start = new_buf;
|
2015-08-27 02:45:56 +03:00
|
|
|
header[strrchr(#header, '-')-2]=0;
|
2016-12-12 01:58:11 +03:00
|
|
|
sprintf(new_buf,"<html><head><title>Source: %s</title><body><pre>",#header);
|
|
|
|
new_buf += strlen(new_buf);
|
2014-03-30 15:57:13 +04:00
|
|
|
for (i=bufpointer; i<bufpointer+bufsize; i++)
|
|
|
|
{
|
|
|
|
ww = ESBYTE[i];
|
|
|
|
switch (ww)
|
|
|
|
{
|
|
|
|
case '<':
|
|
|
|
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
|
|
|
|
{
|
2014-04-01 01:03:20 +04:00
|
|
|
strcpy(new_buf, "<font color=#bbb><");
|
2014-03-31 21:14:16 +04:00
|
|
|
new_buf+=21;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = COMMENT;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
2014-04-01 01:03:20 +04:00
|
|
|
if (mode != COMMENT)
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, "<font color=#00f><");
|
|
|
|
new_buf+=21;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = TAG;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '>':
|
2014-03-30 17:51:53 +04:00
|
|
|
if (mode == OPTION_VALUE) //fix non-closed quote in TAG
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, ""</font>");
|
|
|
|
new_buf+=13;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = TAG;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
2014-03-30 17:51:53 +04:00
|
|
|
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, "></font>");
|
|
|
|
new_buf+=11;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = TEXT;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
2014-03-30 17:51:53 +04:00
|
|
|
if (mode == TAG)
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, "></font>");
|
|
|
|
new_buf+=11;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = TEXT;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '\"':
|
|
|
|
case '\'':
|
2014-03-30 17:51:53 +04:00
|
|
|
if (mode == TAG)
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, "<font color=#f0f>'");
|
2014-03-30 15:57:13 +04:00
|
|
|
new_buf+=22;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = OPTION_VALUE;
|
|
|
|
break;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
2014-03-30 17:51:53 +04:00
|
|
|
if (mode == OPTION_VALUE)
|
2014-03-30 15:57:13 +04:00
|
|
|
{
|
2014-03-31 21:14:16 +04:00
|
|
|
strcpy(new_buf, "'</font>");
|
2014-03-30 15:57:13 +04:00
|
|
|
new_buf+=12;
|
2014-03-30 17:51:53 +04:00
|
|
|
mode = TAG;
|
|
|
|
break;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
|
|
|
default:
|
2014-03-31 21:14:16 +04:00
|
|
|
ESBYTE[new_buf] = ww;
|
|
|
|
new_buf++;
|
2014-03-30 15:57:13 +04:00
|
|
|
}
|
|
|
|
}
|
2014-03-31 21:14:16 +04:00
|
|
|
ESBYTE[new_buf] = 0;
|
|
|
|
bufsize = new_buf - new_buf_start;
|
2014-03-30 15:57:13 +04:00
|
|
|
free(bufpointer);
|
|
|
|
bufpointer = new_buf_start;
|
|
|
|
}
|