#include "HTUtils.h" #include "tcp.h" #include "HTParse.h" #include "LYGlobalDefs.h" #include "HTAlert.h" #include "LYCurses.h" #include "LYSignal.h" #include "LYUtils.h" #include "LYClean.h" #include "LYStrings.h" #include "GridText.h" #include "LYSystem.h" #include "LYMail.h" #include "LYCharSets.h" /* to get current charset for mail header */ #include "LYLeaks.h" #define FREE(x) if (x) {free(x); x = NULL;} BOOLEAN term_letter; /* Global variable for async i/o. */ PRIVATE void terminate_letter PARAMS((int sig)); PRIVATE void remove_tildes PARAMS((char *string)); /* ** mailform() sends form content to the mailto address(es). - FM */ PUBLIC void mailform ARGS4( char *, mailto_address, char *, mailto_subject, char *, mailto_content, char *, mailto_type) { FILE *fd; char *address = NULL; char *ccaddr = NULL; char *keywords = NULL; char *searchpart = NULL; char *cp = NULL, *cp0 = NULL, *cp1 = NULL; char subject[80]; char self[80]; char cmd[512]; int len, i, ch; #if defined(VMS) || defined(DOSPATH) char my_tmpfile[256]; char *address_ptr1, *address_ptr2; char *command = NULL; BOOLEAN first = TRUE; BOOLEAN isPMDF = FALSE; char hdrfile[256]; FILE *hfd; if (!strncasecomp(system_mail, "PMDF SEND", 9)) { isPMDF = TRUE; } #endif /* VMS */ if (!mailto_address || !mailto_content) { HTAlert(BAD_FORM_MAILTO); return; } subject[0] = '\0'; self[0] = '\0'; if ((cp = (char *)strchr(mailto_address,'\n')) != NULL) *cp = '\0'; StrAllocCopy(address, mailto_address); /* * Check for a ?searchpart. - FM */ if ((cp = strchr(address, '?')) != NULL) { StrAllocCopy(searchpart, cp); *cp = '\0'; cp = (searchpart + 1); if (*cp != '\0') { /* * Seek and handle a subject=foo. - FM */ while (*cp != '\0') { if ((*(cp - 1) == '?' || *(cp - 1) == '&') && !strncasecomp(cp, "subject=", 8)) break; cp++; } if (*cp) { cp += 8; if ((cp1 = strchr(cp, '&')) != NULL) { *cp1 = '\0'; } if (*cp) { HTUnEscape(subject); LYstrncpy(subject, cp, 70); } if (cp1) { *cp1 = '&'; cp1 = NULL; } } /* * Seek and handle to=address(es) fields. * Appends to address. - FM */ cp = (searchpart + 1); while (*cp != '\0') { if ((*(cp - 1) == '?' || *(cp - 1) == '&') && !strncasecomp(cp, "to=", 3)) { cp += 3; if ((cp1 = strchr(cp, '&')) != NULL) { *cp1 = '\0'; } while (*cp == ',' || isspace((unsigned char)*cp)) cp++; if (*cp) { if (*address) { StrAllocCat(address, ","); } StrAllocCat(address, cp); } if (cp1) { *cp1 = '&'; cp = cp1; cp1 = NULL; } else { break; } } cp++; } /* * Seek and handle cc=address(es) fields. Excludes * Bcc=address(es) as unsafe. We may append our own * cc (below) as a list for the actual mailing. - FM */ cp = (searchpart + 1); while (*cp != '\0') { if ((*(cp - 1) == '?' || *(cp - 1) == '&') && !strncasecomp(cp, "cc=", 3)) { cp += 3; if ((cp1 = strchr(cp, '&')) != NULL) { *cp1 = '\0'; } while (*cp == ',' || isspace((unsigned char)*cp)) cp++; if (*cp) { if (ccaddr == NULL) { StrAllocCopy(ccaddr, cp); } else { StrAllocCat(ccaddr, ","); StrAllocCat(ccaddr, cp); } } if (cp1) { *cp1 = '&'; cp = cp1; cp1 = NULL; } else { break; } } cp++; } /* * Seek and handle keywords=term(s) fields. - FM */ cp = (searchpart + 1); while (*cp != '\0') { if ((*(cp - 1) == '?' || *(cp - 1) == '&') && !strncasecomp(cp, "keywords=", 9)) { cp += 9; if ((cp1 = strchr(cp, '&')) != NULL) { *cp1 = '\0'; } while (*cp == ',' || isspace((unsigned char)*cp)) cp++; if (*cp) { if (keywords == NULL) { StrAllocCopy(keywords, cp); } else { StrAllocCat(keywords, cp); StrAllocCat(keywords, ", "); } } if (cp1) { *cp1 = '&'; cp = cp1; cp1 = NULL; } else { break; } } cp++; } if (keywords != NULL) { if (*keywords != '\0') { HTUnEscape(keywords); } else { FREE(keywords); } } FREE(searchpart); } } /* * Convert any Explorer semi-colon Internet address * separators to commas. - FM */ cp = address; while ((cp1 = strchr(cp, '@')) != NULL) { cp1++; if ((cp0 = strchr(cp1, ';')) != NULL) { *cp0 = ','; cp1 = cp0 + 1; } cp = cp1; } if (address[(strlen(address) - 1)] == ',') address[(strlen(address) - 1)] = '\0'; if (*address == '\0') { FREE(address); FREE(ccaddr); FREE(keywords); HTAlert(BAD_FORM_MAILTO); return; }
/*
* $LynxId: AttrList.h,v 1.15 2008/09/06 15:47:47 tom Exp $
*/
#if !defined(__ATTRLIST_H)
#define __ATTRLIST_H
#include <HText.h>
#include <HTMLDTD.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
ABS_OFF = 0,
STACK_OFF = 0,
STACK_ON,
ABS_ON
};
#define STARTAT 8
enum {
DSTYLE_LINK = HTML_A + STARTAT,
DSTYLE_STATUS = HTML_ELEMENTS + STARTAT,
DSTYLE_ALINK, /* active link */
DSTYLE_NORMAL, /* default attributes */
DSTYLE_OPTION, /* option on the option screen */
DSTYLE_VALUE, /* value on the option screen */
DSTYLE_CANDY, /* possibly going to vanish */
DSTYLE_WHEREIS, /* whereis search target */
DSTYLE_ELEMENTS
};
typedef struct {
int color; /* color highlighting to be done */
int mono; /* mono highlighting to be done */
int cattr; /* attributes to go with the color */
} HTCharStyle;
#define HText_characterStyle CTRACE((tfp,"HTC called from %s/%d\n",__FILE__,__LINE__));_internal_HTC
#undef HText_characterStyle
#define HText_characterStyle _internal_HTC
#if defined(USE_COLOR_STYLE)
extern void _internal_HTC(HText *text, int style, int dir);
#define TEMPSTRINGSIZE 256
extern char class_string[TEMPSTRINGSIZE];
/* stack of attributes during page rendering */
#define MAX_LAST_STYLES 128
extern int last_styles[MAX_LAST_STYLES + 1];
extern int last_colorattr_ptr;
#endif
#ifdef __cplusplus
}
#endif
#endif