if (qfile==(FILE *)0)
(void) rou_alert(0,"TRA=<%s>",line);
else {
- (void) fprintf(qfile,"%s\n",temps);
+ if (temps!=(char *)0)
+ (void) fprintf(qfile,"%s\n",temps);
(void) fprintf(qfile,"%s\n",line);
}
}
PUBLIC _Bool eml_dump_one_tra(FILE *qfile,TRATYP *tra)
{
+#define OPEP "geseml.c:eml_dump_one_tra,"
_Bool status;
status=false;
tra->rcptto
);
(void) print_tra(qfile,line,temps);
+ if (tra->resp!=(char **)0) {
+ char **ptr;
+
+ ptr=tra->resp;
+ while (*ptr!=(char *)0) {
+ (void) rou_alert(0,"%s JMPDBG ptr=<%s>",OPEP,*ptr);
+ (void) snprintf(line,sizeof(line),"\t%s",*ptr);
+ (void) print_tra(qfile,line,(char *)0);
+ ptr++;
+ }
+ }
}
return status;
+#undef OPEP
}
/*
\f
{
#define OPEP "geseml.c:eml_scanqfile,"
+#define FMT "%c %ld %d %s %s %s"
+TRATYP *cur; //previous trans record
char *ptr;
char line[300];
+cur=(TRATYP *)0;
while ((ptr=fgets(line,sizeof(line),qfile))!=(char *)0) {
char id[300];
char from[100];
case 0 : //Removing comment
if ((ptr=strchr(line,'#'))!=(char *)0)
*ptr='\000';
+ (void) rou_stripcrlf(line);
if (strlen(line)==0)
phase=999; //No data within line
break;
case 1 : //scanning line contents
- if (sscanf(line,"%c %ld %d %s %s %s",&code,&date,&delay,id,from,to)!=6) {
- (void) rou_alert(0,"%s Unable to scan <line=%s> (config?)",OPEP,line);
- phase=999; //No data within line
+ switch (line[0]) {
+ case '\t' : //extra response line
+ (void) rou_alert(0,"%s JMPDBG extra=<%s> cur='%p'",OPEP,line,cur);
+ if ((cur!=(TRATYP *)0)&&(strlen(line)>1))
+ cur->resp=(char **)rou_addlist((void **)cur->resp,strdup(line+1));
+ phase=999; //not a scanable trans line
+ break;
+ case 'C' : //Directives
+ case 'L' :
+ case 'R' :
+ case 'W' :
+ if (sscanf(line,FMT,&code,&date,&delay,id,from,to)!=6) {
+ (void) rou_alert(0,"%s Unable to scan <line=%s> (config?)",OPEP,line);
+ phase=999; //No data within line
+ }
+ break;
+ default :
+ (void) rou_alert(0,"%s Unexpected code within <line=%s> (config?)",
+ OPEP,line);
+ phase=999; //No data within line
+ break;
}
break;
case 2 : //scanning line contents
if (strlen(id)>0) { //always?
- TRATYP *tra;
-
- tra=(TRATYP *)calloc(1,sizeof(TRATYP));
- tra->code=code;
- tra->date=date;
- tra->delay=delay;
- tra->sessid=strdup(id);
- tra->mailfrom=strdup(from);
- tra->rcptto=strdup(to);
- list=(TRATYP **)rou_addlist((void **)list,(void *)tra);
+ cur=(TRATYP *)calloc(1,sizeof(TRATYP));
+ cur->code=code;
+ cur->date=date;
+ cur->delay=delay;
+ cur->sessid=strdup(id);
+ cur->mailfrom=strdup(from);
+ cur->rcptto=strdup(to);
+ list=(TRATYP **)rou_addlist((void **)list,(void *)cur);
}
break;
default : //SAFE Guard