-//
// Output an HTML message, modifying it slightly to make sure it plays nice
// with the rest of our web framework.
//
// Copyright (c) 2005-2022 by the citadel.org team
//
// This program is open source software. Use, duplication, or
-// disclosure are subject to the GNU General Public License v3.
+// disclosure is subject to the GNU General Public License v3.
#include "webcit.h"
void stripquotes(char *s) {
int len;
- if (!s)
+ if (!s) {
return;
+ }
len = strlen(s);
- if (len < 2)
+ if (len < 2) {
return;
+ }
if (((s[0] == '\"') && (s[len - 1] == '\"')) || ((s[0] == '\'') && (s[len - 1] == '\''))) {
s[len - 1] = 0;
char *ptr;
char buf[64];
- if (!charset)
+ if (!charset) {
return;
- if (!meta_http_equiv)
+ }
+ if (!meta_http_equiv) {
return;
- if (!meta_content)
+ }
+ if (!meta_content) {
return;
+ }
- if (strcasecmp(meta_http_equiv, "Content-type"))
+ if (strcasecmp(meta_http_equiv, "Content-type")) {
return;
+ }
ptr = strchr(meta_content, ';');
- if (!ptr)
+ if (!ptr) {
return;
+ }
safestrncpy(buf, ++ptr, sizeof buf);
- striplt(buf);
+ string_trim(buf);
if (!strncasecmp(buf, "charset=", 8)) {
strcpy(charset, &buf[8]);
}
// Remove wandering punctuation
- if ((ptr = strchr(charset, '\"')))
+ if ((ptr = strchr(charset, '\"'))) {
*ptr = 0;
- striplt(charset);
+ }
+ string_trim(charset);
}
}
meta = malloc(meta_length + 1);
safestrncpy(meta, meta_start, meta_length);
meta[meta_length] = 0;
- striplt(meta);
+ string_trim(meta);
if (!strncasecmp(meta, "HTTP-EQUIV=", 11)) {
meta_http_equiv = strdup(&meta[11]);
spaceptr = strchr(meta_http_equiv, ' ');