int status;
char *line;
-_Bool empty;
char *action;
char data[300];
int phase;
status=false;
line=(char *)0;
-empty=false;
action="DATA";
(void) strcpy(data,"");
phase=0;
}
switch (data[0]) {
case 'D' : //pure data
- if ((strcmp(data+2,".")==0)&&(empty==true))
- (void) strcat(data,".");
+ if (data[2]=='.') {
+ (void) memmove(data+3,data+2,strlen(data+2));
+ }
(void) tcp_write(fd->socptr,data+2);
- empty=(strlen(data+2)==0);
break;
case 'C' : //data marker
switch (data[2]) {
case '.' : //end of data marker
- (void) tcp_write(fd->socptr,"");
(void) tcp_write(fd->socptr,".");
completed=true;
break;
D:this is a line with a dot
D:
D:.
+D:.single dot
D:end
D:ligne court|
C:.
}
break;
case 1 : { //transmitting data to remote
- _Bool empty;
char data[300];
sent=0;
- empty=false;
while (fgets(data,sizeof(data),qfile)!=(char *)0) {
- if ((empty==true)&&(strcmp(data,".")==0))
- (void) strcat(data,".");
- empty=(strlen(data)==0);
+ do { //cleaning line
+ register int taille;
+ register char *ptr;
+
+ taille=strlen(data)-1;
+ if (taille<0)
+ break;
+ ptr=data+taille;
+ if ((*ptr!='\n')&&(*ptr!='\r'))
+ break;
+ *ptr='\000';
+ }
+ while (strlen(data)>0);
+ if ((strlen(data)>0)&&(data[0]=='.'))
+ //dot escape
+ (void) memmove(data+1,data,strlen(data));
sent+=tcp_write(rmt->socptr,data);
(void) rou_alert(0,"%s JMPDBG data=<%s>",OPEP,data);
}
break;
}
- case 2 : //transmitting and empty line
- (void) tcp_write(rmt->socptr,"");
+ case 2 : //end of transmission
break;
case 3 : //closing datafile
qfile=eml_closeqfile(qfile);
_Bool done;
FILE *queue;
-_Bool empty;
_Bool completed;
int phase;
_Bool proceed;
done=false;
queue=(FILE *)0;
-empty=false;
completed=false;
phase=0;
proceed=setdirectives(contact,"tmp");
phase=999; //trouble trouble
break; //exiting loop
}
- if ((empty==true)&&(strcmp(line,".")==0)) {
+ if (strcmp(line,".")==0) {
completed=true;
}
else {
- if (empty==true) {
- (void) fprintf(queue,"\n");
- if (strcmp(line,"..")==0)
- line[1]='\000'; //removing double dot
- }
- empty=(strlen(line)==0);
- if (empty==false)
- (void) fprintf(queue,"%s\n",line);
+ if ((strlen(line)>1)&&(line[0]=='.'))
+ (void) memmove(line,line+1,strlen(line));
+ (void) fprintf(queue,"%s\n",line);
}
line=rou_freestr(line);
}
#define OPEP "lvleml.c:senddata,"
int rspcode;
+int sent;
int phase;
_Bool proceed;
rspcode=0;
+sent=0;
phase=0;
proceed=true;
while (proceed==true) {
}
break;
case 1 : //sending session data
- (void) tcp_send_smtp_data(rmt,sessid);
+ sent=tcp_send_smtp_data(rmt,sessid);
+ (void) log_fprintlog(rmt->logptr,false,"Sent '%05d' bytes",sent);
+ if (sent<0)
+ phase=999; //No need to wait form response code
break;
case 2 : //sending session data
rspcode=tcp_smtp_command(rmt,".");