struct cefile. The memory cost will be negligible and it
simplifies the MIME parser code a bit.
int c_subtype; /* internal flag for content subtype */
/* Content-Transfer-Encoding info (decoded contents) */
int c_subtype; /* internal flag for content subtype */
/* Content-Transfer-Encoding info (decoded contents) */
- CE c_cefile; /* structure holding decoded content */
+ struct cefile c_cefile; /* structure holding decoded content */
int c_encoding; /* internal flag for encoding type */
/* Content-MD5 info */
int c_encoding; /* internal flag for encoding type */
/* Content-MD5 info */
static int
init_decoded_content (CT ct)
{
static int
init_decoded_content (CT ct)
{
- CE ce;
-
- if ((ce = (CE) calloc (1, sizeof(*ce))) == NULL)
- adios (NULL, "out of memory");
-
- ct->c_cefile = ce;
ct->c_ceopenfnx = open7Bit; /* since unencoded */
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = NULL; /* since unencoded */
ct->c_ceopenfnx = open7Bit; /* since unencoded */
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = NULL; /* since unencoded */
/* allocate basic structure for handling decoded content */
init_decoded_content (ct);
/* allocate basic structure for handling decoded content */
init_decoded_content (ct);
ci = &ct->c_ctinfo;
set_id (ct, 0);
ci = &ct->c_ctinfo;
set_id (ct, 0);
if ((p = (CT) calloc (1, sizeof(*p))) == NULL)
adios (NULL, "out of memory");
init_decoded_content (p);
if ((p = (CT) calloc (1, sizeof(*p))) == NULL)
adios (NULL, "out of memory");
init_decoded_content (p);
if (get_ctinfo ("message/rfc822", p, 0) == NOTOK)
done (1);
p->c_type = CT_MESSAGE;
if (get_ctinfo ("message/rfc822", p, 0) == NOTOK)
done (1);
p->c_type = CT_MESSAGE;
static int
compose_content (CT ct)
{
static int
compose_content (CT ct)
{
switch (ct->c_type) {
case CT_MULTIPART:
switch (ct->c_type) {
case CT_MULTIPART:
char *cp = NULL, buffer[BUFSIZ];
struct text *t = NULL;
FILE *in = NULL;
char *cp = NULL, buffer[BUFSIZ];
struct text *t = NULL;
FILE *in = NULL;
/*
* handle multipart by scanning all subparts
/*
* handle multipart by scanning all subparts
unsigned char digest[16];
unsigned char outbuf[25];
MD5_CTX mdContext;
unsigned char digest[16];
unsigned char outbuf[25];
MD5_CTX mdContext;
char *infilename = ce->ce_file ? ce->ce_file : ct->c_file;
FILE *in;
char *infilename = ce->ce_file ? ce->ce_file : ct->c_file;
FILE *in;
{
int cachetype;
char *file, cachefile[BUFSIZ];
{
int cachetype;
char *file, cachefile[BUFSIZ];
if (!ct->c_id) {
advise (NULL, "no %s: field in %s", ID_FIELD, ct->c_file);
if (!ct->c_id) {
advise (NULL, "no %s: field in %s", ID_FIELD, ct->c_file);
void
free_encoding (CT ct, int toplevel)
{
void
free_encoding (CT ct, int toplevel)
{
- CE ce;
-
- if (!(ce = ct->c_cefile))
- return;
if (ce->ce_fp) {
fclose (ce->ce_fp);
if (ce->ce_fp) {
fclose (ce->ce_fp);
- if (toplevel) {
- free ((char *) ce);
- ct->c_cefile = NULL;
- } else {
ct->c_ceopenfnx = NULL;
}
}
ct->c_ceopenfnx = NULL;
}
}
/* print internal flags for transfer encoding */
fprintf (stderr, " transfer encoding 0x%x params 0x%x\n",
/* print internal flags for transfer encoding */
fprintf (stderr, " transfer encoding 0x%x params 0x%x\n",
- ct->c_encoding, (unsigned int)(unsigned long) ct->c_cefile);
+ ct->c_encoding, (unsigned int)(unsigned long) &ct->c_cefile);
/* print Content-ID */
if (ct->c_id)
/* print Content-ID */
if (ct->c_id)
static int
list_encoding (CT ct)
{
static int
list_encoding (CT ct)
{
- if ((ce = ct->c_cefile))
- fprintf (stderr, " decoded fp 0x%x file \"%s\"\n",
- (unsigned int)(unsigned long) ce->ce_fp,
- ce->ce_file ? ce->ce_file : "");
+ fprintf (stderr, " decoded fp 0x%x file \"%s\"\n",
+ (unsigned int)(unsigned long) ce->ce_fp,
+ ce->ce_file ? ce->ce_file : "");
int fd;
size_t inbytes;
char c, *file, buffer[BUFSIZ];
int fd;
size_t inbytes;
char c, *file, buffer[BUFSIZ];
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
int fd;
char *cp, *file;
char c, buffer[BUFSIZ];
int fd;
char *cp, *file;
char c, buffer[BUFSIZ];
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
{
int fd, result;
char *file;
{
int fd, result;
char *file;
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
file = NULL;
if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
static int
init_encoding (CT ct, OpenCEFunc openfnx)
{
static int
init_encoding (CT ct, OpenCEFunc openfnx)
{
- CE ce;
-
- if ((ce = (CE) calloc (1, sizeof(*ce))) == NULL)
- adios (NULL, "out of memory");
-
- ct->c_cefile = ce;
ct->c_ceopenfnx = openfnx;
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = size_encoding;
ct->c_ceopenfnx = openfnx;
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = size_encoding;
void
close_encoding (CT ct)
{
void
close_encoding (CT ct)
{
- CE ce;
-
- if (!(ce = ct->c_cefile))
- return;
if (ce->ce_fp) {
fclose (ce->ce_fp);
if (ce->ce_fp) {
fclose (ce->ce_fp);
int fd;
unsigned long size;
char *file;
int fd;
unsigned long size;
char *file;
- if (!(ce = ct->c_cefile))
- return (ct->c_end - ct->c_begin);
-
if (ce->ce_fp && fstat (fileno (ce->ce_fp), &st) != NOTOK)
return (long) st.st_size;
if (ce->ce_fp && fstat (fileno (ce->ce_fp), &st) != NOTOK)
return (long) st.st_size;
char *cp, *ep, buffer[BUFSIZ];
/* sbeck -- handle suffixes */
CI ci;
char *cp, *ep, buffer[BUFSIZ];
/* sbeck -- handle suffixes */
CI ci;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
char *cp, *ep;
char buffer[BUFSIZ];
unsigned char mask;
char *cp, *ep;
char buffer[BUFSIZ];
unsigned char mask;
/* sbeck -- handle suffixes */
CI ci;
MD5_CTX mdContext;
/* sbeck -- handle suffixes */
CI ci;
MD5_CTX mdContext;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
/* sbeck -- handle suffixes */
char *cp;
CI ci;
/* sbeck -- handle suffixes */
char *cp;
CI ci;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
if (ce->ce_fp) {
fseek (ce->ce_fp, 0L, SEEK_SET);
goto ready_to_go;
int fd, cachetype;
char cachefile[BUFSIZ];
struct exbody *e = ct->c_ctexbody;
int fd, cachetype;
char cachefile[BUFSIZ];
struct exbody *e = ct->c_ctexbody;
switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
case NOTOK:
switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
case NOTOK:
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
struct exbody *e;
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
struct exbody *e;
static char *username = NULL;
static char *password = NULL;
e = ct->c_ctexbody;
static char *username = NULL;
static char *password = NULL;
e = ct->c_ctexbody;
if ((ftp = context_find (nmhaccessftp)) && !*ftp)
ftp = NULL;
if ((ftp = context_find (nmhaccessftp)) && !*ftp)
ftp = NULL;
int len, buflen;
char *bp, buffer[BUFSIZ], *vec[7];
struct exbody *e = ct->c_ctexbody;
int len, buflen;
char *bp, buffer[BUFSIZ], *vec[7];
struct exbody *e = ct->c_ctexbody;
switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
case NOTOK:
switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
case NOTOK:
openURL (CT ct, char **file)
{
struct exbody *e = ct->c_ctexbody;
openURL (CT ct, char **file)
{
struct exbody *e = ct->c_ctexbody;
char *urlprog, *program;
char buffer[BUFSIZ], cachefile[BUFSIZ];
int fd, caching, cachetype;
char *urlprog, *program;
char buffer[BUFSIZ], cachefile[BUFSIZ];
int fd, caching, cachetype;