* complete copyright information.
*/
-#include <h/mh.h>
+#include "h/mh.h"
+#include "sbr/context_find.h"
+#include "sbr/pidstatus.h"
+#include "sbr/arglist.h"
+#include "sbr/error.h"
#include <fcntl.h>
-#include <h/md5.h>
-#include <h/mts.h>
-#include <h/tws.h>
-#include <h/mime.h>
-#include <h/mhparse.h>
-#include <h/utils.h>
+#include "h/md5.h"
+#include "h/mts.h"
+#include "h/tws.h"
+#include "h/mime.h"
+#include "h/mhparse.h"
+#include "h/utils.h"
#include "mhmisc.h"
-#include <h/mhcachesbr.h>
+#include "h/mhcachesbr.h"
#include "sbr/m_mktemp.h"
#include "mhfree.h"
#ifdef HAVE_ICONV
static int
InitMultiPart (CT ct)
{
- int inout;
+ bool inout;
long last, pos;
char *cp, *dp;
PM pm;
last = ct->c_end;
next = &m->mp_parts;
part = NULL;
- inout = 1;
+ inout = true;
while ((gotlen = getline(&bufp, &buflen, fp)) != -1) {
if (pos > last)
part->mp_part = p;
pos = p->c_begin;
fseek (fp, pos, SEEK_SET);
- inout = 0;
+ inout = false;
} else {
if (strcmp (bufp + 2, m->mp_start) == 0) {
- inout = 1;
+ inout = true;
end_part:
p = part->mp_part;
p->c_end = ftell(fp) - (gotlen + 1);
example, a text/plain part before a text/html part in a
multipart/alternative part, for example, where it belongs. */
void
-reverse_alternative_parts (CT ct) {
+reverse_alternative_parts (CT ct)
+{
if (ct->c_type == CT_MULTIPART) {
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
openBase64 (CT ct, char **file)
{
ssize_t cc, len;
- int fd, own_ct_fp = 0;
+ int fd;
+ bool own_ct_fp = false;
char *cp, *buffer = NULL;
/* sbeck -- handle suffixes */
CI ci;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
- own_ct_fp = 1;
+ own_ct_fp = true;
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
static int
openQuoted (CT ct, char **file)
{
- int cc, digested, len, quoted, own_ct_fp = 0;
+ int cc, digested, len, quoted;
+ bool own_ct_fp = false;
char *cp, *ep;
char *bufp = NULL;
size_t buflen;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
- own_ct_fp = 1;
+ own_ct_fp = true;
}
if ((digested = ct->c_digested))
int
open7Bit (CT ct, char **file)
{
- int cc, fd, len, own_ct_fp = 0;
+ int cc, fd, len;
+ bool own_ct_fp = false;
char buffer[BUFSIZ];
/* sbeck -- handle suffixes */
char *cp;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
- own_ct_fp = 1;
+ own_ct_fp = true;
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
static int
openFTP (CT ct, char **file)
{
- int cachetype, caching, fd;
+ int cachetype;
+ bool caching;
+ int fd;
int len, buflen;
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
}
ce->ce_unlink = (*file == NULL);
- caching = 0;
+ caching = false;
cachefile[0] = '\0';
if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write"))
&& find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
- caching = 1;
+ caching = true;
}
}
CE ce = &ct->c_cefile;
char *urlprog, *program;
char buffer[BUFSIZ], cachefile[BUFSIZ];
- int fd, caching, cachetype;
+ int fd;
+ bool caching;
+ int cachetype;
struct msgs_array args = { 0, 0, NULL};
pid_t child_id;
}
ce->ce_unlink = (*file == NULL);
- caching = 0;
+ caching = false;
cachefile[0] = '\0';
if (find_cache(NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
- caching = 1;
+ caching = true;
}
}
{
struct multipart *m = (struct multipart *) ct->c_ctparams;
char *boundary;
- int found_boundary = 0;
+ bool found_boundary = false;
int max = BUFSIZ;
char *bufp = NULL;
size_t buflen;
if (before) {
if (! strcmp (bufp, boundary)) {
- found_boundary = 1;
+ found_boundary = true;
}
} else {
if (! found_boundary && ! strcmp (bufp, boundary)) {
- found_boundary = 1;
+ found_boundary = true;
continue;
}
}
char *
-ct_type_str (int type) {
+ct_type_str (int type)
+{
switch (type) {
case CT_APPLICATION:
return "application";
char *
-ct_subtype_str (int type, int subtype) {
+ct_subtype_str (int type, int subtype)
+{
switch (type) {
case CT_APPLICATION:
switch (subtype) {
int
-ct_str_type (const char *type) {
+ct_str_type (const char *type)
+{
struct str2init *s2i;
for (s2i = str2cts; s2i->si_key; ++s2i) {
int
-ct_str_subtype (int type, const char *subtype) {
+ct_str_subtype (int type, const char *subtype)
+{
struct k2v *kv;
switch (type) {
/* Find the content type and InitFunc for the CT. */
const struct str2init *
-get_ct_init (int type) {
+get_ct_init (int type)
+{
const struct str2init *sp;
for (sp = str2cts; sp->si_key; ++sp) {
}
const char *
-ce_str (int encoding) {
+ce_str (int encoding)
+{
switch (encoding) {
case CE_BASE64:
return "base64";
/* Find the content type and InitFunc for the content encoding method. */
const struct str2init *
-get_ce_method (const char *method) {
+get_ce_method (const char *method)
+{
struct str2init *sp;
for (sp = str2ces; sp->si_key; ++sp) {
while (*cp == ';') {
char *dp, *vp, *up, *nameptr, *valptr, *charset = NULL, *lang = NULL;
- int encoded = 0, partial = 0, len = 0, index = 0;
+ bool encoded = false;
+ bool partial = false;
+ int len = 0, index = 0;
cp++;
while (isspace ((unsigned char) *cp))
for (vp = cp; vp < up; vp++) {
if (*vp == '*' && vp < up - 1) {
- partial = 1;
+ partial = true;
continue;
}
if (*vp == '*' && vp == up - 1) {
- encoded = 1;
+ encoded = true;
} else if (partial) {
if (isdigit((unsigned char) *vp))
index = *vp - '0' + index * 10;
*/
char *
-content_charset (CT ct) {
+content_charset (CT ct)
+{
char *ret_charset = NULL;
ret_charset = get_param(ct->c_ctinfo.ci_first_pm, "charset", '?', 0);
* necessary
*/
-char *get_param_value(PM pm, char replace)
+char *
+get_param_value(PM pm, char replace)
{
static char buffer[4096]; /* I hope no parameters are larger */
size_t bufsize = sizeof(buffer);