* All Rights Reserved, for now.
*/
-#include <stdio.h> /* XXX -- debugging */
#include <stdlib.h>
#include <string.h>
#include <pcre.h>
mps->endre = pcre_compile(boundpat, PCRE_MULTILINE, &etxt, &epos, 0);
if (!mps->endre) goto fail;
- /* fprintf(stderr, "multipart_init: boundpat = %s\n", boundpat); */
-
free(boundpat); /* no longer needed */
boundpat = 0;
msgproc *next;
char *pmatch = 0;
- /* fprintf(stderr, "multipart_process: %d chars\n", len); */
-
while (l > 0 && mps->state != STATE_END) {
- /* re_stream_exec needs to be tweaked:
- - set state to nomatch and process to
- end of match if partial
- match is not at end of input.
- - set state to nomatch and process to
- beginning of match if previous state
- was partial match and new match begins
- after beginning of input
- */
if (re_stream_result(mps->boundre) == -1)
pmatch = strdup(re_stream_getresult(mps->boundre));
- /* fprintf(stderr, "multipart_process: s=%p, l=%d, state = %d\n",
- s, l, mps->state);
- fwrite(s, p, 1, stderr);
- fprintf(stderr,"\n");
- if (pmatch)
- fprintf(stderr, "multipart_process pmatch = '%s'\n",
- pmatch); */
p = re_stream_exec(mps->boundre, s, l);
if (p < 0) break;
match = re_stream_result(mps->boundre);
- /* fprintf(stderr, "multipart_process: p = %d, result = %d\n",
- p, re_stream_result(mps->boundre)); */
-
switch(mps->state) {
case STATE_PREAMBLE:
if (match == 1) {
*/
/* Stream-based regular expression matching implementation */
-#include <stdio.h> /* XXX -- debugging */
#include <pcre.h>
#include <strings.h>
#include "re_stream.h"
sre->ovec, sizeof(sre->ovec),
sre->wspace, sizeof(sre->wspace));
- /* fprintf(stderr, "in (%d) = %s\n", slen, sub);
- fprintf(stderr, "pcre_dfa_exec: match = %d\n", match); */
-
if (match < 0 && match != PCRE_ERROR_PARTIAL) {
sre->result[0] = sre->rlen = 0;
sre->state = 0;