Convert-UUlib
view release on metacpan or search on metacpan
uulib/uuscan.c view on Meta::CPAN
/* "From " handled in IsKnownHeader */
/* knownmsgheaders */
LSTR ("Return-Path"), LSTR ("Received"), LSTR ("Reply-To"),
LSTR ("From"), LSTR ("Sender"), LSTR ("Resent-Reply-To"), LSTR ("Resent-From"),
LSTR ("Resent-Sender"), LSTR ("Date"), LSTR ("Resent-Date"), LSTR ("To"),
LSTR ("Resent-To"), LSTR ("Cc"), LSTR ("Bcc"), LSTR ("Resent-bcc"),
LSTR ("Message-ID"), LSTR ("Resent-Message-Id"), LSTR ("In-Reply-To"),
LSTR ("References"), LSTR ("Keywords"), LSTR ("Subject"), LSTR ("Comments"),
LSTR ("Delivery-Date"), LSTR ("Posted-Date"), LSTR ("Received-Date"),
LSTR ("Precedence"),
LSTR ("Path"), LSTR ("Newsgroups"), LSTR ("Organization"), LSTR ("Lines"),
LSTR ("NNTP-Posting-Host"),
/* knownminehaders */
LSTR ("Mime-Version"), LSTR ("Content-Transfer-Encoding"),
LSTR ("Content-Type"), LSTR ("Content-Disposition"),
LSTR ("Content-Description"), LSTR ("Content-Length")
};
/*
* for MIME (plaintext) parts without filename
*/
int mimseqno;
/*
* how many lines do we read when checking for headers
*/
#define WAITHEADER 10
/*
* The stack for encapsulated Multipart messages
*/
#define MSMAXDEPTH 3
int mssdepth = 0;
scanstate multistack[MSMAXDEPTH+1];
/*
* The state and the local envelope
*/
headers localenv;
scanstate sstate;
/*
* mallocable areas
*/
char *uuscan_shlline;
char *uuscan_shlline2;
char *uuscan_pvvalue;
char *uuscan_phtext;
char *uuscan_sdline;
char *uuscan_sdbhds1;
char *uuscan_sdbhds2;
char *uuscan_spline;
/*
* Macro: print cancellation message in UUScanPart
*/
#define SPCANCEL() {UUMessage(uuscan_id,__LINE__,UUMSG_NOTE,uustring(S_SCAN_CANCEL));*errcode=UURET_CANCEL;goto ScanPartEmergency;}
/*
* Is line empty? A line is empty if it is composed of whitespace.
*/
static int
IsLineEmpty (char *data)
{
if (data == NULL) return 0;
while (*data && isspace (*data)) data++;
return ((*data)?0:1);
}
/*
* Is this a header line? A header line has alphanumeric characters
* followed by a colon.
*/
static int
IsHeaderLine (char *data)
{
if (data == NULL) return 0;
if (*data == ':') return 0;
while (*data && (isalnum (*data) || *data=='-')) data++;
return (*data == ':') ? 1 : 0;
}
/*
* Scans a potentially folded header line from the input file. If
* initial is non-NULL, it is the first line of the header, useful
* if the calling function just coincidentally noticed that this is
* a header.
* RFC0822 does not specify a maximum length for headers, but we
* truncate everything beyond an insane value of 1024 characters.
*/
/* (schmorp)every later rfc says 998 octets max */
static char *
ScanHeaderLine (FILE *datei, char *initial)
{
char *ptr=uuscan_shlline;
char *ptr2, *p2, *p3;
int llength, c;
long curpos;
if (initial) {
_FP_strncpy (uuscan_shlline, initial, 1024);
} else {
/* read first line */
if (feof (datei) || ferror (datei))
return NULL;
if (_FP_fgets (uuscan_shlline, 1024, datei) == NULL)
return NULL;
}
llength = strlen (uuscan_shlline);
( run in 0.844 second using v1.01-cache-2.11-cpan-39bf76dae61 )