Try another way

This commit is contained in:
Andrew Pamment 2017-03-31 09:30:23 +10:00
parent bd70eefe6c
commit 52cff627a5
5 changed files with 184 additions and 33 deletions

View File

@ -5,7 +5,7 @@ JAMLIB = deps/jamlib/jamlib.a
ZMODEM = deps/Xmodem/libzmodem.a ZMODEM = deps/Xmodem/libzmodem.a
LUA = deps/lua/liblua.a LUA = deps/lua/liblua.a
B64 = deps/libb64-1.2/src/libb64.a B64 = deps/libb64-1.2/src/libb64.a
MICROHTTPD=-lmicrohttpd -liconv MICROHTTPD=-lmicrohttpd
ODOORS = deps/odoors/libs-`uname -s`/libODoors.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a
JSMN = deps/jsmn/libjsmn.a JSMN = deps/jsmn/libjsmn.a
CDK = deps/cdk-5-20161210/libcdk.a CDK = deps/cdk-5-20161210/libcdk.a

View File

@ -5,7 +5,7 @@ JAMLIB = deps/jamlib/jamlib.a
ZMODEM = deps/Xmodem/libzmodem.a ZMODEM = deps/Xmodem/libzmodem.a
LUA = deps/lua/liblua.a LUA = deps/lua/liblua.a
B64 = deps/libb64-1.2/src/libb64.a B64 = deps/libb64-1.2/src/libb64.a
MICROHTTPD=-lmicrohttpd -liconv MICROHTTPD=-lmicrohttpd
ODOORS = deps/odoors/libs-`uname -s`/libODoors.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a
JSMN = deps/jsmn/libjsmn.a JSMN = deps/jsmn/libjsmn.a
CDK = deps/cdk-5-20161210/libcdk.a CDK = deps/cdk-5-20161210/libcdk.a

View File

@ -5,7 +5,7 @@ JAMLIB = deps/jamlib/jamlib.a
ZMODEM = deps/Xmodem/libzmodem.a ZMODEM = deps/Xmodem/libzmodem.a
LUA = deps/lua/liblua.a LUA = deps/lua/liblua.a
B64 = deps/libb64-1.2/src/libb64.a B64 = deps/libb64-1.2/src/libb64.a
MICROHTTPD=-lmicrohttpd -liconv MICROHTTPD=-lmicrohttpd
ODOORS = deps/odoors/libs-`uname -s`/libODoors.a ODOORS = deps/odoors/libs-`uname -s`/libODoors.a
JSMN = deps/jsmn/libjsmn.a JSMN = deps/jsmn/libjsmn.a
CDK = deps/cdk-5-20161210/libcdk.a CDK = deps/cdk-5-20161210/libcdk.a

174
deps/aha/aha.c vendored
View File

@ -353,6 +353,180 @@ char * aha(char *input)
} }
switch (c) switch (c)
{ {
case '\x01' : append_output(&output, "☺", &size, &outat); break;
case '\x02' : append_output(&output, "☻", &size, &outat); break;
case '\x03' : append_output(&output, "♥", &size, &outat); break;
case '\x04' : append_output(&output, "♦", &size, &outat); break;
case '\x05' : append_output(&output, "♣", &size, &outat); break;
case '\x06' : append_output(&output, "♠", &size, &outat); break;
case '\x07' : append_output(&output, "•", &size, &outat); break;
case '\x08' : append_output(&output, "◘", &size, &outat); break;
case '\x09' : append_output(&output, "○", &size, &outat); break;
case '\x0a' : append_output(&output, "◘", &size, &outat); break;
case '\x0b' : append_output(&output, "♂", &size, &outat); break;
case '\x0c' : append_output(&output, "♀", &size, &outat); break;
case '\x0d' : append_output(&output, "♪", &size, &outat); break;
case '\x0e' : append_output(&output, "♫", &size, &outat); break;
case '\x0f' : append_output(&output, "☼", &size, &outat); break;
case '\x10' : append_output(&output, "▸", &size, &outat); break;
case '\x11' : append_output(&output, "◂", &size, &outat); break;
case '\x12' : append_output(&output, "↕", &size, &outat); break;
case '\x13' : append_output(&output, "‼", &size, &outat); break;
case '\x14' : append_output(&output, "¶", &size, &outat); break;
case '\x15' : append_output(&output, "§", &size, &outat); break;
case '\x16' : append_output(&output, "▬", &size, &outat); break;
case '\x17' : append_output(&output, "↨", &size, &outat); break;
case '\x18' : append_output(&output, "↑", &size, &outat); break;
case '\x19' : append_output(&output, "↓", &size, &outat); break;
case '\x1a' : append_output(&output, "→", &size, &outat); break;
case '\x1b' : append_output(&output, "←", &size, &outat); break;
case '\x1c' : append_output(&output, "∟", &size, &outat); break;
case '\x1d' : append_output(&output, "↔", &size, &outat); break;
case '\x1e' : append_output(&output, "▴", &size, &outat); break;
case '\x1f' : append_output(&output, "▾", &size, &outat); break;
case '\x21' : append_output(&output, "!", &size, &outat); break;
case '\x22' : append_output(&output, """, &size, &outat); break;
case '\x23' : append_output(&output, "#", &size, &outat); break;
case '\x24' : append_output(&output, "$", &size, &outat); break;
case '\x25' : append_output(&output, "%", &size, &outat); break;
case '\x26' : append_output(&output, "&", &size, &outat); break;
case '\x27' : append_output(&output, "'", &size, &outat); break;
case '\x28' : append_output(&output, "(", &size, &outat); break;
case '\x29' : append_output(&output, ")", &size, &outat); break;
case '\x2a' : append_output(&output, "*", &size, &outat); break;
case '\x2b' : append_output(&output, "+", &size, &outat); break;
case '\x2c' : append_output(&output, ",", &size, &outat); break;
case '\x2d' : append_output(&output, "-", &size, &outat); break;
case '\x2e' : append_output(&output, ".", &size, &outat); break;
case '\x2f' : append_output(&output, "/", &size, &outat); break;
case '\x7f' : append_output(&output, "⌂", &size, &outat); break;
case '\x80' : append_output(&output, "Ç", &size, &outat); break;
case '\x81' : append_output(&output, "ü", &size, &outat); break;
case '\x82' : append_output(&output, "é", &size, &outat); break;
case '\x83' : append_output(&output, "â", &size, &outat); break;
case '\x84' : append_output(&output, "ä", &size, &outat); break;
case '\x85' : append_output(&output, "à", &size, &outat); break;
case '\x86' : append_output(&output, "å", &size, &outat); break;
case '\x87' : append_output(&output, "ç", &size, &outat); break;
case '\x88' : append_output(&output, "ê", &size, &outat); break;
case '\x89' : append_output(&output, "ë", &size, &outat); break;
case '\x8a' : append_output(&output, "è", &size, &outat); break;
case '\x8b' : append_output(&output, "ï", &size, &outat); break;
case '\x8c' : append_output(&output, "î", &size, &outat); break;
case '\x8d' : append_output(&output, "ì", &size, &outat); break;
case '\x8e' : append_output(&output, "Ä", &size, &outat); break;
case '\x8f' : append_output(&output, "Å", &size, &outat); break;
case '\x90' : append_output(&output, "É", &size, &outat); break;
case '\x91' : append_output(&output, "æ", &size, &outat); break;
case '\x92' : append_output(&output, "Æ", &size, &outat); break;
case '\x93' : append_output(&output, "ô", &size, &outat); break;
case '\x94' : append_output(&output, "ö", &size, &outat); break;
case '\x95' : append_output(&output, "ò", &size, &outat); break;
case '\x96' : append_output(&output, "û", &size, &outat); break;
case '\x97' : append_output(&output, "ù", &size, &outat); break;
case '\x98' : append_output(&output, "ÿ", &size, &outat); break;
case '\x99' : append_output(&output, "Ö", &size, &outat); break;
case '\x9a' : append_output(&output, "Ü", &size, &outat); break;
case '\x9b' : append_output(&output, "¢", &size, &outat); break;
case '\x9c' : append_output(&output, "£", &size, &outat); break;
case '\x9d' : append_output(&output, "¥", &size, &outat); break;
case '\x9e' : append_output(&output, "₧", &size, &outat); break;
case '\x9f' : append_output(&output, "ƒ", &size, &outat); break;
case '\xa0' : append_output(&output, "á", &size, &outat); break;
case '\xa1' : append_output(&output, "í", &size, &outat); break;
case '\xa2' : append_output(&output, "ó", &size, &outat); break;
case '\xa3' : append_output(&output, "ú", &size, &outat); break;
case '\xa4' : append_output(&output, "ñ", &size, &outat); break;
case '\xa5' : append_output(&output, "Ñ", &size, &outat); break;
case '\xa6' : append_output(&output, "ª", &size, &outat); break;
case '\xa7' : append_output(&output, "º", &size, &outat); break;
case '\xa8' : append_output(&output, "¿", &size, &outat); break;
case '\xa9' : append_output(&output, "⌐", &size, &outat); break;
case '\xaa' : append_output(&output, "¬", &size, &outat); break;
case '\xab' : append_output(&output, "½", &size, &outat); break;
case '\xac' : append_output(&output, "¼", &size, &outat); break;
case '\xad' : append_output(&output, "¡", &size, &outat); break;
case '\xae' : append_output(&output, "«", &size, &outat); break;
case '\xaf' : append_output(&output, "»", &size, &outat); break;
case '\xb0' : append_output(&output, "░", &size, &outat); break;
case '\xb1' : append_output(&output, "▒", &size, &outat); break;
case '\xb2' : append_output(&output, "▓", &size, &outat); break;
case '\xb3' : append_output(&output, "│", &size, &outat); break;
case '\xb4' : append_output(&output, "┤", &size, &outat); break;
case '\xb5' : append_output(&output, "╡", &size, &outat); break;
case '\xb6' : append_output(&output, "╢", &size, &outat); break;
case '\xb7' : append_output(&output, "╖", &size, &outat); break;
case '\xb8' : append_output(&output, "╕", &size, &outat); break;
case '\xb9' : append_output(&output, "╣", &size, &outat); break;
case '\xba' : append_output(&output, "║", &size, &outat); break;
case '\xbb' : append_output(&output, "╗", &size, &outat); break;
case '\xbc' : append_output(&output, "╝", &size, &outat); break;
case '\xbd' : append_output(&output, "╜", &size, &outat); break;
case '\xbe' : append_output(&output, "╛", &size, &outat); break;
case '\xbf' : append_output(&output, "┐", &size, &outat); break;
case '\xc0' : append_output(&output, "└", &size, &outat); break;
case '\xc1' : append_output(&output, "┴", &size, &outat); break;
case '\xc2' : append_output(&output, "┬", &size, &outat); break;
case '\xc3' : append_output(&output, "├", &size, &outat); break;
case '\xc4' : append_output(&output, "─", &size, &outat); break;
case '\xc5' : append_output(&output, "┼", &size, &outat); break;
case '\xc6' : append_output(&output, "╞", &size, &outat); break;
case '\xc7' : append_output(&output, "╟", &size, &outat); break;
case '\xc8' : append_output(&output, "╚", &size, &outat); break;
case '\xc9' : append_output(&output, "╔", &size, &outat); break;
case '\xca' : append_output(&output, "╩", &size, &outat); break;
case '\xcb' : append_output(&output, "╦", &size, &outat); break;
case '\xcc' : append_output(&output, "╠", &size, &outat); break;
case '\xcd' : append_output(&output, "═", &size, &outat); break;
case '\xce' : append_output(&output, "╬", &size, &outat); break;
case '\xcf' : append_output(&output, "╧", &size, &outat); break;
case '\xd0' : append_output(&output, "╨", &size, &outat); break;
case '\xd1' : append_output(&output, "╤", &size, &outat); break;
case '\xd2' : append_output(&output, "╥", &size, &outat); break;
case '\xd3' : append_output(&output, "╙", &size, &outat); break;
case '\xd4' : append_output(&output, "╛", &size, &outat); break;
case '\xd5' : append_output(&output, "╒", &size, &outat); break;
case '\xd6' : append_output(&output, "╓", &size, &outat); break;
case '\xd7' : append_output(&output, "╫", &size, &outat); break;
case '\xd8' : append_output(&output, "╪", &size, &outat); break;
case '\xd9' : append_output(&output, "┘", &size, &outat); break;
case '\xda' : append_output(&output, "┌", &size, &outat); break;
case '\xdb' : append_output(&output, "█", &size, &outat); break;
case '\xdc' : append_output(&output, "▄", &size, &outat); break;
case '\xdd' : append_output(&output, "▼", &size, &outat); break;
case '\xde' : append_output(&output, "▐", &size, &outat); break;
case '\xdf' : append_output(&output, "▀", &size, &outat); break;
case '\xe0' : append_output(&output, "α", &size, &outat); break;
case '\xe1' : append_output(&output, "β", &size, &outat); break;
case '\xe2' : append_output(&output, "Γ", &size, &outat); break;
case '\xe3' : append_output(&output, "π", &size, &outat); break;
case '\xe4' : append_output(&output, "Σ", &size, &outat); break;
case '\xe5' : append_output(&output, "σ", &size, &outat); break;
case '\xe6' : append_output(&output, "µ", &size, &outat); break;
case '\xe7' : append_output(&output, "τ", &size, &outat); break;
case '\xe8' : append_output(&output, "Φ", &size, &outat); break;
case '\xe9' : append_output(&output, "Θ", &size, &outat); break;
case '\xea' : append_output(&output, "Ω", &size, &outat); break;
case '\xeb' : append_output(&output, "δ", &size, &outat); break;
case '\xec' : append_output(&output, "∞", &size, &outat); break;
case '\xed' : append_output(&output, "∅", &size, &outat); break;
case '\xee' : append_output(&output, "∈", &size, &outat); break;
case '\xef' : append_output(&output, "∩", &size, &outat); break;
case '\xf0' : append_output(&output, "≡", &size, &outat); break;
case '\xf1' : append_output(&output, "±", &size, &outat); break;
case '\xf2' : append_output(&output, "≥", &size, &outat); break;
case '\xf3' : append_output(&output, "≤", &size, &outat); break;
case '\xf4' : append_output(&output, "⌠", &size, &outat); break;
case '\xf5' : append_output(&output, "⌡", &size, &outat); break;
case '\xf6' : append_output(&output, "÷", &size, &outat); break;
case '\xf7' : append_output(&output, "≈", &size, &outat); break;
case '\xf8' : append_output(&output, "°", &size, &outat); break;
case '\xf9' : append_output(&output, "∙", &size, &outat); break;
case '\xfa' : append_output(&output, "·", &size, &outat); break;
case '\xfb' : append_output(&output, "√", &size, &outat); break;
case '\xfc' : append_output(&output, "ⁿ", &size, &outat); break;
case '\xfd' : append_output(&output, "²", &size, &outat); break;
case '\xfe' : append_output(&output, "▪", &size, &outat); break;
case '&': append_output(&output, "&", &size, &outat); break; case '&': append_output(&output, "&", &size, &outat); break;
case '\"': append_output(&output, """, &size, &outat); break; case '\"': append_output(&output, """, &size, &outat); break;
case '<': append_output(&output, "&lt;", &size, &outat); break; case '<': append_output(&output, "&lt;", &size, &outat); break;

View File

@ -7,7 +7,6 @@
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#include <iconv.h>
#include "bbs.h" #include "bbs.h"
#include "jamlib/jam.h" #include "jamlib/jam.h"
@ -270,14 +269,10 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
char buffer[4096]; char buffer[4096];
int chars; int chars;
int i; int i;
iconv_t ic;
char *aha_text; char *aha_text;
char *aha_out; char *aha_out;
char *aha_cp437;
size_t insz;
size_t outsz;
char *iconv_cp437;
char *iconv_text;
if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) { if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) {
return NULL; return NULL;
} }
@ -470,28 +465,10 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
len += strlen(buffer); len += strlen(buffer);
aha_text = (char *)malloc(jmh.TxtLen + 1);
aha_text = (char *)malloc((jmh.TxtLen + 1) * 2); memcpy(aha_text, body, jmh.TxtLen);
aha_cp437 = (char *)malloc(jmh.TxtLen + 1); aha_text[jmh.TxtLen] = '\0';
iconv_cp437 = aha_cp437;
iconv_text = aha_text;
memcpy(aha_cp437, body, jmh.TxtLen);
aha_cp437[jmh.TxtLen] = '\0';
insz = jmh.TxtLen;
outsz = jmh.TxtLen * 2;
memset(aha_text, 0, (jmh.TxtLen + 1) * 2);
ic = iconv_open("UTF-8", "CP437");
iconv(ic, &iconv_cp437, &insz, &iconv_text, &outsz);
iconv_close(ic);
free(aha_cp437);
aha_out = aha(aha_text); aha_out = aha(aha_text);
while (len + strlen(aha_out) > max_len - 1) { while (len + strlen(aha_out) > max_len - 1) {
max_len += 4096; max_len += 4096;
@ -502,7 +479,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
free(aha_out); free(aha_out);
free(aha_text); free(aha_text);
sprintf(buffer, "</div>\n"); sprintf(buffer, "</div>\n");
if (len + strlen(buffer) > max_len - 1) { if (len + strlen(buffer) > max_len - 1) {
max_len += 4096; max_len += 4096;
@ -513,7 +490,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
sprintf(buffer, "<div class=\"msg-reply-form\">\n"); sprintf(buffer, "<div class=\"msg-reply-form\">\n");
if (len + strlen(buffer) > max_len - 1) { if (len + strlen(buffer) > max_len - 1) {
max_len += 4096; max_len += 4096;
page = (char *)realloc(page, max_len); page = (char *)realloc(page, max_len);