Whitespace cleanups: trailing spaces.

Remove them.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
This commit is contained in:
Dan Cross 2018-10-30 22:32:01 +00:00 committed by Andrew Pamment
parent 8a6348f5b1
commit e8eef519ed
11 changed files with 390 additions and 390 deletions

View File

@ -67,7 +67,7 @@ endif
${CC} -c -o $@ $< ${CFLAGS}
magickawww: ${OBJS} ${WWWOBJS} ${LUA} ${ZMODEM} ${B64} ${JAMLIB} ${JSMN} ${UUID}
${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd
${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd
magicka: ${OBJS} ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
${CC} -o ../magicka $^ ${LIBS}

View File

@ -1600,7 +1600,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
free(from);
ptr_vector_apply(&msg_lines, free);
destroy_ptr_vector(&msg_lines);
return 0;
return 0;
}
s_printf(get_string(115));
s_readstring_inject(buffer, 64, subject);

View File

@ -542,21 +542,21 @@ void list_users(struct user_record *user) {
int check_fullname_j(char *firstandlastname) {
char *firstname = strdup(firstandlastname);
if (!firstname) {
return 0;
}
char *lastname = strchr(firstname, ' ');
int ret;
if (lastname == NULL) {
return 0;
}
*lastname = '\0';
lastname++;
ret = check_fullname(firstname, lastname);
free(firstname);
return ret;
}

View File

@ -249,5 +249,5 @@ FILE *fopen_node_path(const char *filename, const char *mode) {
snprintf(buffer, PATH_MAX, "%s/node%d/%s", conf.bbs_path, mynode, filename);
return fopen(buffer, mode);
return fopen(buffer, mode);
}

View File

@ -15,7 +15,7 @@ char *www_blog() {
struct www_tag *child_tag;
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
@ -28,8 +28,8 @@ char *www_blog() {
cur_tag = www_tag_new("p", NULL);
www_tag_add_child(cur_tag, www_tag_new(NULL, "No Entries"));
www_tag_add_child(page, cur_tag);
return www_tag_unwravel(page);
}
for (size_t i = 0; i < ptr_vector_len(&entries); i++) {
@ -47,39 +47,39 @@ char *www_blog() {
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "blog-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-title");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("h3", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, entry->subject);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-date");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, timebuf);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, hour >= 12 ? "pm" : "am");
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-author");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "by ");
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, entry->author);
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "blog-entry");
@ -87,9 +87,9 @@ char *www_blog() {
child_tag = www_tag_new("p", NULL);
www_tag_add_child(cur_tag, child_tag);
stralloc blog_body = EMPTY_STRALLOC;
for (char *p = entry->body; *p != '\0'; ++p) {
if (*p != '\r') {
stralloc_append1(&blog_body, *p);
@ -100,16 +100,16 @@ char *www_blog() {
continue;
}
}
child_child_tag = www_tag_new(NULL, blog_body.s);
free(blog_body.s);
www_tag_add_child(child_tag, child_child_tag);
}
ptr_vector_apply(&entries, free);
destroy_ptr_vector(&entries);
return www_tag_unwravel(page);
}

View File

@ -144,28 +144,28 @@ char *www_new_email() {
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Email");
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_0(&url);
www_tag_add_attrib(cur_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(cur_tag, "method", "POST");
www_tag_add_attrib(cur_tag, "onsubmit", "return validate()");
www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded");
@ -173,26 +173,26 @@ char *www_new_email() {
child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "recipient");
www_tag_add_attrib(child_tag, "id", "recipient");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "subject");
www_tag_add_attrib(child_tag, "id", "subject");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
@ -203,13 +203,13 @@ char *www_new_email() {
www_tag_add_attrib(child_tag, "cols", "79");
www_tag_add_attrib(child_tag, "id", "body");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "submit");
www_tag_add_attrib(child_tag, "name", "submit");
@ -218,7 +218,7 @@ char *www_new_email() {
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
return www_tag_unwravel(page);
}
@ -280,17 +280,17 @@ char *www_email_display(struct user_record *user, int email) {
if (sqlite3_step(res) != SQLITE_ROW) {
page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "No such email!");
www_tag_add_child(child_tag, child_child_tag);
return www_tag_unwravel(page);
}
id = sqlite3_column_int(res, 0);
@ -301,14 +301,14 @@ char *www_email_display(struct user_record *user, int email) {
localtime_r(&date, &msg_date);
page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag);
@ -319,42 +319,42 @@ char *www_email_display(struct user_record *user, int email) {
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-subject");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-from");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-date");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Date: ");
www_tag_add_child(child_tag, child_child_tag);
if (conf.date_style == 1)
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
else
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "id", "msgbody");
www_tag_add_child(page, cur_tag);
aha(body, cur_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "email-reply-form");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h3", NULL);
www_tag_add_child(cur_tag, child_tag);
@ -362,20 +362,20 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(child_tag, "method", "POST");
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "hidden");
www_tag_add_attrib(child_child_tag, "name", "recipient");
@ -383,21 +383,21 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject");
stralloc subj = EMPTY_STRALLOC;
if (strncasecmp(subject, "re:", 3) != 0)
stralloc_cats(&subj, "RE: ");
stralloc_cats(&subj, subject);
stralloc_0(&subj);
www_tag_add_attrib(child_child_tag, "value", subj.s);
free(subj.s);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
@ -410,7 +410,7 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_attrib(child_child_tag, "cols", "79");
www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag);
stralloc content = EMPTY_STRALLOC;
stralloc_cats(&content, from);
@ -429,12 +429,12 @@ char *www_email_display(struct user_record *user, int email) {
stralloc_append1(&content, *p);
++column;
}
stralloc_0(&content);
child_child_child_tag = www_tag_new(NULL, content.s);
free(content.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL);
@ -511,14 +511,14 @@ char *www_email_summary(struct user_record *user) {
sqlite3_bind_text(res, 1, user->loginname, -1, 0);
page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag);
@ -528,7 +528,7 @@ char *www_email_summary(struct user_record *user) {
child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/new");
stralloc_0(&url);
@ -543,7 +543,7 @@ char *www_email_summary(struct user_record *user) {
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "div-table");
www_tag_add_child(page, cur_tag);
while (sqlite3_step(res) == SQLITE_ROW) {
char datebuf[32];
@ -556,7 +556,7 @@ char *www_email_summary(struct user_record *user) {
time_t date = (time_t)sqlite3_column_int(res, 4);
localtime_r(&date, &msg_date);
child_tag = www_tag_new("div", NULL);
if (seen != 0) {
@ -566,7 +566,7 @@ char *www_email_summary(struct user_record *user) {
}
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-id");
www_tag_add_child(child_tag, child_child_tag);
@ -574,30 +574,30 @@ char *www_email_summary(struct user_record *user) {
url = EMPTY_STRALLOC;
stralloc_cat_long(&url, msgid);
stralloc_0(&url);
child_child_child_tag = www_tag_new(NULL, url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-subject");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_cat_long(&url, msgid);
stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-from");
www_tag_add_child(child_tag, child_child_tag);
@ -609,33 +609,33 @@ char *www_email_summary(struct user_record *user) {
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-date");
www_tag_add_child(child_tag, child_child_tag);
if (conf.date_style == 1)
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
else
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
child_child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_child_tag, child_child_child_tag);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/delete/");
stralloc_cat_long(&url, id);
stralloc_0(&url);
stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "email-delete");
www_tag_add_child(child_child_tag, child_child_child_tag);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
}

View File

@ -318,7 +318,7 @@ char *www_files_display_listing(int dir, int sub) {
struct file_sub *fsub = ptr_vector_get(&fdir->file_subs, sub);
assert(fsub != NULL);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
@ -351,53 +351,53 @@ char *www_files_display_listing(int dir, int sub) {
www_tag_destroy(page);
return NULL;
}
cur_tag = www_tag_new("table", NULL);
www_tag_add_attrib(cur_tag, "class", "fileentry");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("thead", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("tr", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Filename");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Size");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Description");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_tag = www_tag_new("tbody", NULL);
www_tag_add_child(cur_tag, child_tag);
www_tag_add_child(cur_tag, child_tag);
while (sqlite3_step(res) == SQLITE_ROW) {
char *filename = strdup((char *)sqlite3_column_text(res, 1));
char *base_filename = basename(filename);
child_child_tag = www_tag_new("tr", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filename");
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new("a", NULL);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "files/areas/");
stralloc_cat_long(&url, dir);
@ -405,20 +405,20 @@ char *www_files_display_listing(int dir, int sub) {
stralloc_cat_long(&url, sub);
stralloc_append1(&url, '/');
www_encode(&url, base_filename);
stralloc_0(&url);
www_tag_add_attrib(child_child_child_child_tag, "href", url.s);
free(url.s);
child_child_child_child_child_tag = www_tag_new(NULL, base_filename);
www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag);
www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag);
int size = sqlite3_column_int(res, 3);
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filesize");
www_tag_add_child(child_child_tag, child_child_child_tag);
int c = 'b';
if (size > 1024) {
size /= 1024;
@ -432,9 +432,9 @@ char *www_files_display_listing(int dir, int sub) {
size /= 1024;
c = 'G';
}
stralloc size_str = EMPTY_STRALLOC;
stralloc_cat_long(&size_str, size);
stralloc_append1(&size_str, c);
@ -445,7 +445,7 @@ char *www_files_display_listing(int dir, int sub) {
child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filedesc");
www_tag_add_child(child_child_tag, child_child_child_tag);
char *description = strdup((char *)sqlite3_column_text(res, 2));
for (char *p = description; *p != '\0'; ++p) {
if (*p == '\n')
@ -468,14 +468,14 @@ char *www_files_areas() {
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "File Directories");
www_tag_add_child(child_tag, child_child_tag);
@ -483,11 +483,11 @@ char *www_files_areas() {
struct file_directory *dir = ptr_vector_get(&conf.file_directories, i);
if (!dir->display_on_web)
continue;
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "conference-list-item");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new(NULL, dir->name);
www_tag_add_child(cur_tag, child_tag);
@ -496,22 +496,22 @@ char *www_files_areas() {
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "area-list-item");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "files/areas/");
stralloc_cat_long(&url, i);
stralloc_append1(&url, '/');
stralloc_cat_long(&url, j);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, sub->name);
www_tag_add_child(child_tag, child_child_tag);
}

View File

@ -35,10 +35,10 @@ char *www_last10() {
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Last 10 Callers");
www_tag_add_child(child_tag, child_child_tag);
@ -53,11 +53,11 @@ char *www_last10() {
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "last10-row");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-name");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, callers[i].name);
www_tag_add_child(child_child_tag, child_child_child_tag);
@ -65,10 +65,10 @@ char *www_last10() {
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-location");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, callers[i].location);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-date");
www_tag_add_child(child_tag, child_child_tag);
@ -86,14 +86,14 @@ char *www_last10() {
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-new");
www_tag_add_child(child_tag, child_child_tag);
stralloc url = EMPTY_STRALLOC;
stralloc_copys(&url, conf.www_url);
stralloc_cats(&url, "static/newuser.png");
stralloc_0(&url);
child_child_child_tag = www_tag_new("img", NULL);
www_tag_add_attrib(child_child_child_tag, "src", url.s);
free(url.s);

View File

@ -110,7 +110,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
char *from;
char *subject;
char datebuf[32];
stralloc url;
struct www_tag *page;
@ -119,7 +119,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
struct www_tag *child_child_child_child_tag;
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
return NULL;
struct mail_conference *mc = get_conf(conference);
@ -134,10 +134,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, mc->name);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, " - ");
www_tag_add_child(child_tag, child_child_tag);
@ -148,9 +148,9 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "button");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/new/");
@ -158,12 +158,12 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/');
stralloc_cat_long(&url, area);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Message");
www_tag_add_child(child_tag, child_child_tag);
}
@ -172,7 +172,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
if (mhrs == NULL) {
cur_tag = www_tag_new("h3", NULL);
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new(NULL, "No Messages");
www_tag_add_child(cur_tag, child_tag);
} else {
@ -206,7 +206,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
subject = strdup(mhrs->msgs[i]->subject);
child_tag = www_tag_new("div", NULL);
if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) {
www_tag_add_attrib(child_tag, "class", "msg-summary-flag");
} else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
@ -215,23 +215,23 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
www_tag_add_attrib(child_tag, "class", "msg-summary-seen");
}
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-id");
www_tag_add_child(child_tag, child_child_tag);
url = EMPTY_STRALLOC;
stralloc_cat_long(&url, mhrs->msgs[i]->msg_no + 1);
stralloc_0(&url);
child_child_child_tag = www_tag_new(NULL, url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-subject");
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
@ -242,41 +242,41 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/');
stralloc_cat_long(&url, mhrs->msgs[i]->msg_h->MsgNum);
stralloc_0(&url);
child_child_child_tag = www_tag_new("a", NULL);
www_tag_add_attrib(child_child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-from");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-to");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, to);
www_tag_add_child(child_child_tag, child_child_child_tag);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-date");
www_tag_add_child(child_tag, child_child_tag);
if (conf.date_style == 1)
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
else
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
child_child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_child_tag, child_child_child_tag);
free(to);
free(from);
free(subject);
@ -286,11 +286,11 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-summary-next");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/");
stralloc_cat_long(&url, conference);
@ -299,7 +299,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_cats(&url, "/?skip=");
stralloc_cat_long(&url, skip + 50);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
@ -310,7 +310,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
if (skip > 0) {
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-summary-prev");
www_tag_add_child(page, cur_tag);
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
if (skip - 50 < 0) {
@ -329,10 +329,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_cats(&url, "/?skip=");
stralloc_cat_long(&url, skip - 50);
}
stralloc_0(&url);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Prev");
www_tag_add_child(child_tag, child_child_tag);
@ -380,7 +380,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
struct www_tag *child_tag;
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
return NULL;
struct mail_conference *mc = get_conf(conference);
@ -475,24 +475,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
JAM_WriteLastRead(jb, user->id, &jlr);
JAM_CloseMB(jb);
free(jb);
page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/");
stralloc_cat_long(&url, conference);
stralloc_append1(&url, '/');
stralloc_cat_long(&url, area);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
@ -508,17 +508,17 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_child_tag = www_tag_new(NULL, ma->name);
www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL);
if (msgbase_is_flagged(user, conference, area, msg)) {
www_tag_add_attrib(cur_tag, "class", "msg-view-header-flagged");
} else {
www_tag_add_attrib(cur_tag, "class", "msg-view-header");
}
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "msg-view-subject");
www_tag_add_child(cur_tag, child_tag);
@ -551,7 +551,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new("span", NULL);
www_tag_add_attrib(child_child_tag, "class", "bbsname");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, nodename);
www_tag_add_child(child_child_tag, child_child_child_tag);
@ -574,7 +574,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
} else {
snprintf(buffer, sizeof buffer, "From: %s", from);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
}
child_tag = www_tag_new("div", NULL);
@ -583,7 +583,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, to);
www_tag_add_child(child_tag, child_child_tag);
@ -609,9 +609,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/flag/");
stralloc_cat_long(&url, conference);
@ -620,24 +620,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/');
stralloc_cat_long(&url, msg);
stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("img", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "static/flag.png");
stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "src", url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "id", "msgbody");
www_tag_add_child(page, cur_tag);
@ -650,23 +650,23 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-reply-form");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h3", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Reply");
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("form", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/");
stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(child_tag, "method", "POST");
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded;charset=UTF-8");
www_tag_add_child(cur_tag, child_tag);
@ -697,13 +697,13 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "recipient");
www_tag_add_attrib(child_child_tag, "value", from);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
@ -713,16 +713,16 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject");
if (strncasecmp(subject, "re:", 3) != 0) {
snprintf(buffer, sizeof buffer, "RE: %s", subject);
www_tag_add_attrib(child_child_tag, "value", buffer);
} else {
www_tag_add_attrib(child_child_tag, "value", subject);
}
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
@ -733,9 +733,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
www_tag_add_attrib(child_child_tag, "wrap", "soft");
www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag);
stralloc text = EMPTY_STRALLOC;
stralloc_append1(&text, ' ');
stralloc_append1(&text, from[0]);
stralloc_cats(&text, "> ");
@ -781,20 +781,20 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
stralloc_cats(&text, buffer);
}
free(body2);
stralloc_0(&text);
child_child_child_tag = www_tag_new(NULL, text.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "submit");
www_tag_add_attrib(child_child_tag, "name", "submit");
www_tag_add_attrib(child_child_tag, "value", "Reply");
www_tag_add_child(child_tag, child_child_tag);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
}
@ -1148,11 +1148,11 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
} else {
snprintf(buffer, sizeof buffer, "\r");
}
char *p = body;
stralloc unhtmlized = EMPTY_STRALLOC;
// remove nbsp
while (*p != '\0') {
if ((*p & 0xff) == 0xc2 && (*(p + 1) & 0xff) == 0xa0) {
@ -1161,12 +1161,12 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
} else {
stralloc_append1(&unhtmlized, *p);
}
p++;
}
stralloc_0(&unhtmlized);
body2 = www_wordwrap(unhtmlized.s, 73);
free(unhtmlized.s);
if (body2 == NULL) {
@ -1176,9 +1176,9 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
free(jb);
return 0;
}
body3 = str2dup(body2, buffer);
if (body3 == NULL) {
free(body2);
@ -1237,28 +1237,28 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
char buffer[10];
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Message");
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/");
stralloc_0(&url);
www_tag_add_attrib(cur_tag, "action", url.s);
free(url.s);
@ -1273,7 +1273,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
snprintf(buffer, sizeof buffer, "%d", conference);
www_tag_add_attrib(child_tag, "value", buffer);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "hidden");
www_tag_add_attrib(child_tag, "name", "area");
@ -1332,7 +1332,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
www_tag_add_attrib(child_tag, "name", "submit");
www_tag_add_attrib(child_tag, "value", "Send");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);

View File

@ -17,95 +17,95 @@ static char *www_tag_sanatize(char *data, int isdata) {
case '>':
stralloc_cats(&str, "&gt;");
break;
case '\x01':
case '\x01':
stralloc_cats(&str, "&#x263A;");
break;
case '\x02':
case '\x02':
stralloc_cats(&str, "&#x263B;");
break;
case '\x03':
case '\x03':
stralloc_cats(&str, "&#x2665;");
break;
case '\x04':
case '\x04':
stralloc_cats(&str, "&#x2666;");
break;
case '\x05':
case '\x05':
stralloc_cats(&str, "&#x2663;");
break;
case '\x06':
case '\x06':
stralloc_cats(&str, "&#x2660;");
break;
case '\x07':
case '\x07':
stralloc_cats(&str, "&#x2022;");
break;
case '\x08':
case '\x08':
stralloc_cats(&str, "&#x25D8;");
break;
case '\x09':
case '\x09':
stralloc_cats(&str, "&#x25CB;");
break;
case '\x0b':
case '\x0b':
stralloc_cats(&str, "&#x2642;");
break;
case '\x0c':
case '\x0c':
stralloc_cats(&str, "&#x2640;");
break;
case '\x0e':
case '\x0e':
stralloc_cats(&str, "&#x266B;");
break;
case '\x0f':
stralloc_cats(&str, "&#x263C;");
break;
case '\x10':
case '\x10':
stralloc_cats(&str, "&#x25B8;");
break;
case '\x11':
case '\x11':
stralloc_cats(&str, "&#x25C2;");
break;
case '\x12':
case '\x12':
stralloc_cats(&str, "&#x2195;");
break;
case '\x13':
case '\x13':
stralloc_cats(&str, "&#x203C;");
break;
case '\x14':
case '\x14':
stralloc_cats(&str, "&#x00B6;");
break;
case '\x15':
case '\x15':
stralloc_cats(&str, "&#x00A7;");
break;
case '\x16':
case '\x16':
stralloc_cats(&str, "&#x25AC;");
break;
case '\x17':
case '\x17':
stralloc_cats(&str, "&#x21A8;");
break;
case '\x18':
case '\x18':
stralloc_cats(&str, "&#x2191;");
break;
case '\x19':
case '\x19':
stralloc_cats(&str, "&#x2193;");
break;
case '\x1a':
case '\x1a':
stralloc_cats(&str, "&#x2192;");
break;
case '\x1b':
case '\x1b':
stralloc_cats(&str, "&#x2190;");
break;
case '\x1c':
case '\x1c':
stralloc_cats(&str, "&#x221F;");
break;
case '\x1d':
case '\x1d':
stralloc_cats(&str, "&#x2194;");
break;
case '\x1e':
case '\x1e':
stralloc_cats(&str, "&#x25B4;");
break;
case '\x1f':
case '\x1f':
stralloc_cats(&str, "&#x25BE;");
break;
/*
case '\x21':
case '\x21':
stralloc_cats(&str, "&#x0021;");
break;
case '\x22':
@ -166,364 +166,364 @@ static char *www_tag_sanatize(char *data, int isdata) {
case '\x88':
stralloc_cats(&str, "&#x00EA;");
break;
case '\x89':
case '\x89':
stralloc_cats(&str, "&#x00EB;");
break;
case '\x8a':
case '\x8a':
stralloc_cats(&str, "&#x00E8;");
break;
case '\x8b':
case '\x8b':
stralloc_cats(&str, "&#x00EF;");
break;
case '\x8c':
case '\x8c':
stralloc_cats(&str, "&#x00EE;");
break;
case '\x8d':
case '\x8d':
stralloc_cats(&str, "&#x00EC;");
break;
case '\x8e':
case '\x8e':
stralloc_cats(&str, "&#x00C4;");
break;
case '\x8f':
case '\x8f':
stralloc_cats(&str, "&#x00C5;");
break;
case '\x90':
case '\x90':
stralloc_cats(&str, "&#x00C9;");
break;
case '\x91':
case '\x91':
stralloc_cats(&str, "&#x00E6;");
break;
case '\x92':
case '\x92':
stralloc_cats(&str, "&#x00C6;");
break;
case '\x93':
case '\x93':
stralloc_cats(&str, "&#x00F4;");
break;
case '\x94':
case '\x94':
stralloc_cats(&str, "&#x00F6;");
break;
case '\x95':
case '\x95':
stralloc_cats(&str, "&#x00F2;");
break;
case '\x96':
case '\x96':
stralloc_cats(&str, "&#x00FB;");
break;
case '\x97':
case '\x97':
stralloc_cats(&str, "&#x00F9;");
break;
case '\x98':
case '\x98':
stralloc_cats(&str, "&#x00FF;");
break;
case '\x99':
case '\x99':
stralloc_cats(&str, "&#x00D6;");
break;
case '\x9a':
case '\x9a':
stralloc_cats(&str, "&#x00DC;");
break;
case '\x9b':
case '\x9b':
stralloc_cats(&str, "&#x00A2;");
break;
case '\x9c':
case '\x9c':
stralloc_cats(&str, "&#x00A3;");
break;
case '\x9d':
case '\x9d':
stralloc_cats(&str, "&#x00A5;");
break;
case '\x9e':
case '\x9e':
stralloc_cats(&str, "&#x20A7;");
break;
case '\x9f':
case '\x9f':
stralloc_cats(&str, "&#x0192;");
break;
case '\xa0':
case '\xa0':
stralloc_cats(&str, "&#x00E1;");
break;
case '\xa1':
case '\xa1':
stralloc_cats(&str, "&#x00ED;");
break;
case '\xa2':
case '\xa2':
stralloc_cats(&str, "&#x00F3;");
break;
case '\xa3':
case '\xa3':
stralloc_cats(&str, "&#x00FA;");
break;
case '\xa4':
case '\xa4':
stralloc_cats(&str, "&#x00F1;");
break;
case '\xa5':
case '\xa5':
stralloc_cats(&str, "&#x00D1;");
break;
case '\xa6':
case '\xa6':
stralloc_cats(&str, "&#x00AA;");
break;
case '\xa7':
case '\xa7':
stralloc_cats(&str, "&#x00BA;");
break;
case '\xa8':
case '\xa8':
stralloc_cats(&str, "&#x00BF;");
break;
case '\xa9':
case '\xa9':
stralloc_cats(&str, "&#x2310;");
break;
case '\xaa':
case '\xaa':
stralloc_cats(&str, "&#x00AC;");
break;
case '\xab':
case '\xab':
stralloc_cats(&str, "&#x00BD;");
break;
case '\xac':
case '\xac':
stralloc_cats(&str, "&#x00BC;");
break;
case '\xad':
case '\xad':
stralloc_cats(&str, "&#x00A1;");
break;
case '\xae':
case '\xae':
stralloc_cats(&str, "&#x00AB;");
break;
case '\xaf':
case '\xaf':
stralloc_cats(&str, "&#x00BB;");
break;
case '\xb0':
case '\xb0':
stralloc_cats(&str, "&#x2591;");
break;
case '\xb1':
case '\xb1':
stralloc_cats(&str, "&#x2592;");
break;
case '\xb2':
case '\xb2':
stralloc_cats(&str, "&#x2593;");
break;
case '\xb3':
case '\xb3':
stralloc_cats(&str, "&#x2502;");
break;
case '\xb4':
case '\xb4':
stralloc_cats(&str, "&#x2524;");
break;
case '\xb5':
case '\xb5':
stralloc_cats(&str, "&#x2561;");
break;
case '\xb6':
case '\xb6':
stralloc_cats(&str, "&#x2562;");
break;
case '\xb7':
case '\xb7':
stralloc_cats(&str, "&#x2556;");
break;
case '\xb8':
case '\xb8':
stralloc_cats(&str, "&#x2555;");
break;
case '\xb9':
case '\xb9':
stralloc_cats(&str, "&#x2563;");
break;
case '\xba':
case '\xba':
stralloc_cats(&str, "&#x2551;");
break;
case '\xbb':
case '\xbb':
stralloc_cats(&str, "&#x2557;");
break;
case '\xbc':
case '\xbc':
stralloc_cats(&str, "&#x255D;");
break;
case '\xbd':
case '\xbd':
stralloc_cats(&str, "&#x255C;");
break;
case '\xbe':
case '\xbe':
stralloc_cats(&str, "&#x255B;");
break;
case '\xbf':
case '\xbf':
stralloc_cats(&str, "&#x2510;");
break;
case '\xc0':
case '\xc0':
stralloc_cats(&str, "&#x2514;");
break;
case '\xc1':
case '\xc1':
stralloc_cats(&str, "&#x2534;");
break;
case '\xc2':
case '\xc2':
stralloc_cats(&str, "&#x252C;");
break;
case '\xc3':
case '\xc3':
stralloc_cats(&str, "&#x251C;");
break;
case '\xc4':
case '\xc4':
stralloc_cats(&str, "&#x2500;");
break;
case '\xc5':
case '\xc5':
stralloc_cats(&str, "&#x253C;");
break;
case '\xc6':
case '\xc6':
stralloc_cats(&str, "&#x255E;");
break;
case '\xc7':
case '\xc7':
stralloc_cats(&str, "&#x255F;");
break;
case '\xc8':
case '\xc8':
stralloc_cats(&str, "&#x255A;");
break;
case '\xc9':
case '\xc9':
stralloc_cats(&str, "&#x2554;");
break;
case '\xca':
case '\xca':
stralloc_cats(&str, "&#x2569;");
break;
case '\xcb':
case '\xcb':
stralloc_cats(&str, "&#x2566;");
break;
case '\xcc':
case '\xcc':
stralloc_cats(&str, "&#x2560;");
break;
case '\xcd':
case '\xcd':
stralloc_cats(&str, "&#x2550;");
break;
case '\xce':
case '\xce':
stralloc_cats(&str, "&#x256C;");
break;
case '\xcf':
case '\xcf':
stralloc_cats(&str, "&#x2567;");
break;
case '\xd0':
case '\xd0':
stralloc_cats(&str, "&#x2568;");
break;
case '\xd1':
case '\xd1':
stralloc_cats(&str, "&#x2564;");
break;
case '\xd2':
case '\xd2':
stralloc_cats(&str, "&#x2565;");
break;
case '\xd3':
case '\xd3':
stralloc_cats(&str, "&#x2559;");
break;
case '\xd4':
case '\xd4':
stralloc_cats(&str, "&#x255B;");
break;
case '\xd5':
case '\xd5':
stralloc_cats(&str, "&#x2552;");
break;
case '\xd6':
case '\xd6':
stralloc_cats(&str, "&#x2553;");
break;
case '\xd7':
case '\xd7':
stralloc_cats(&str, "&#x256B;");
break;
case '\xd8':
case '\xd8':
stralloc_cats(&str, "&#x256A;");
break;
case '\xd9':
case '\xd9':
stralloc_cats(&str, "&#x2518;");
break;
case '\xda':
case '\xda':
stralloc_cats(&str, "&#x250C;");
break;
case '\xdb':
case '\xdb':
stralloc_cats(&str, "&#x2588;");
break;
case '\xdc':
case '\xdc':
stralloc_cats(&str, "&#x2584;");
break;
case '\xdd':
case '\xdd':
stralloc_cats(&str, "&#x258C;");
break;
case '\xde':
case '\xde':
stralloc_cats(&str, "&#x2590;");
break;
case '\xdf':
case '\xdf':
stralloc_cats(&str, "&#x2580;");
break;
case '\xe0':
case '\xe0':
stralloc_cats(&str, "&#x03B1;");
break;
case '\xe1':
case '\xe1':
stralloc_cats(&str, "&#x03B2;");
break;
case '\xe2':
case '\xe2':
stralloc_cats(&str, "&#x0393;");
break;
case '\xe3':
case '\xe3':
stralloc_cats(&str, "&#x03C0;");
break;
case '\xe4':
case '\xe4':
stralloc_cats(&str, "&#x03A3;");
break;
case '\xe5':
case '\xe5':
stralloc_cats(&str, "&#x03C3;");
break;
case '\xe6':
case '\xe6':
stralloc_cats(&str, "&#x00B5;");
break;
case '\xe7':
case '\xe7':
stralloc_cats(&str, "&#x03C4;");
break;
case '\xe8':
case '\xe8':
stralloc_cats(&str, "&#x03A6;");
break;
case '\xe9':
case '\xe9':
stralloc_cats(&str, "&#x0398;");
break;
case '\xea':
case '\xea':
stralloc_cats(&str, "&#x03A9;");
break;
case '\xeb':
case '\xeb':
stralloc_cats(&str, "&#x03B4;");
break;
case '\xec':
case '\xec':
stralloc_cats(&str, "&#x221E;");
break;
case '\xed':
case '\xed':
stralloc_cats(&str, "&#x2205;");
break;
case '\xee':
case '\xee':
stralloc_cats(&str, "&#x2208;");
break;
case '\xef':
case '\xef':
stralloc_cats(&str, "&#x2229;");
break;
case '\xf0':
case '\xf0':
stralloc_cats(&str, "&#x2261;");
break;
case '\xf1':
case '\xf1':
stralloc_cats(&str, "&#x00B1;");
break;
case '\xf2':
case '\xf2':
stralloc_cats(&str, "&#x2265;");
break;
case '\xf3':
case '\xf3':
stralloc_cats(&str, "&#x2264;");
break;
case '\xf4':
case '\xf4':
stralloc_cats(&str, "&#x2320;");
break;
case '\xf5':
case '\xf5':
stralloc_cats(&str, "&#x2321;");
break;
case '\xf6':
case '\xf6':
stralloc_cats(&str, "&#x00F7;");
break;
case '\xf7':
case '\xf7':
stralloc_cats(&str, "&#x2248;");
break;
case '\xf8':
case '\xf8':
stralloc_cats(&str, "&#x00B0;");
break;
case '\xf9':
case '\xf9':
stralloc_cats(&str, "&#x2219;");
break;
case '\xfa':
case '\xfa':
stralloc_cats(&str, "&#x00B7;");
break;
case '\xfb':
case '\xfb':
stralloc_cats(&str, "&#x221A;");
break;
case '\xfc':
case '\xfc':
stralloc_cats(&str, "&#x207F;");
break;
case '\xfd':
case '\xfd':
stralloc_cats(&str, "&#x00B2;");
break;
case '\xfe':
stralloc_cats(&str, "&#x25AA;");
case '\xfe':
stralloc_cats(&str, "&#x25AA;");
break;
case ' ':
if (isdata) {
if (*(p+1) == ' ') {
stralloc_cats(&str, "&nbsp;");
stralloc_cats(&str, "&nbsp;");
} else {
if (p > data && (*(p-1) == ' ' || *(p-1) == '\n')) {
stralloc_cats(&str, "&nbsp;");
@ -541,7 +541,7 @@ static char *www_tag_sanatize(char *data, int isdata) {
default:
stralloc_append1(&str, *p);
break;
}
}
}
stralloc_0(&str);
return str.s;
@ -549,27 +549,27 @@ static char *www_tag_sanatize(char *data, int isdata) {
struct www_tag *www_tag_new(char *tag, char *data) {
struct www_tag *new_tag = malloz(sizeof(struct www_tag));
new_tag->attribs = EMPTY_PTR_VECTOR;
new_tag->values = EMPTY_PTR_VECTOR;
new_tag->children = EMPTY_PTR_VECTOR;
if (tag == NULL) {
new_tag->tag = NULL;
/* SANATIZE DATA HERE */
new_tag->data = www_tag_sanatize(data, 1);
} else {
new_tag->tag = strdup(tag);
new_tag->data = NULL;
init_ptr_vector(&new_tag->attribs);
init_ptr_vector(&new_tag->values);
}
init_ptr_vector(&new_tag->children);
return new_tag;
}
@ -595,14 +595,14 @@ char *www_tag_destroy(struct www_tag *tag) {
struct www_tag *child = ptr_vector_del(&tag->children, 0);
www_tag_destroy(child);
}
if (tag->tag != NULL) {
ptr_vector_apply(&tag->attribs, free);
destroy_ptr_vector(&tag->attribs);
ptr_vector_apply(&tag->values, free);
destroy_ptr_vector(&tag->values);
}
destroy_ptr_vector(&tag->children);
destroy_ptr_vector(&tag->children);
}
char *www_tag_unwravel(struct www_tag *tag) {
@ -621,14 +621,14 @@ char *www_tag_unwravel(struct www_tag *tag) {
stralloc_cats(&thedata, (char *)ptr_vector_get(&child->values, i));
stralloc_append1(&thedata, '\"');
}
stralloc_append1(&thedata, '>');
}
char *data = www_tag_unwravel(child);
stralloc_cats(&thedata, data);
free(data);
if (child->tag != NULL) {
stralloc_cats(&thedata, "</");
stralloc_cats(&thedata, child->tag);
@ -654,17 +654,17 @@ char *www_tag_unwravel(struct www_tag *tag) {
ptr_vector_apply(&child->attribs, free);
destroy_ptr_vector(&child->attribs);
ptr_vector_apply(&child->values, free);
destroy_ptr_vector(&child->values);
destroy_ptr_vector(&child->values);
} else {
stralloc_cats(&thedata, child->data);
}
}
}
destroy_ptr_vector(&child->children);
}
stralloc_0(&thedata);
return thedata.s;
}

View File

@ -9,7 +9,7 @@ struct www_tag {
char *data;
struct ptr_vector attribs;
struct ptr_vector values;
struct ptr_vector children;
};