static _Bool dosenddata(FEEDTYP *fd)
{
+#define OPEP "feeder.c:dosenddata,"
+
int status;
char *line;
char *action;
break;
case 3 : //
while (fgets(data,sizeof(data),fd->datatst)!=(char *)0) {
+ (void) eml_removecrlf(data);
(void) rou_alert(0,"JMPDBG got <%s>",data);
- if ((empty==true)||(strcmp(data,".")==0)) {
- phase++; //Eveythin is fine
+ (void) dooutgoing(fd->socptr,data);
+ (void) rou_alert(0,"JMPDBG sent <%s>",data);
+ if ((empty==true)&&(strcmp(data,".")==0)) {
+ phase++; //Eveything is fine
break;
}
empty=false;
case 4 : //phase reached only by data exhaustion
phase=999; //Trouble trouble
break;
- case 5 : //we have completed data transmission
+ case 5 : //all data sent lets say it is good
+ (void) rou_alert(0,"JMPDBG all data sent",data);
status=true;
break;
default : //SAFE Guard
phase++;
}
return status;
+#undef OPEP
}
/*
^L
#-------------------------------------------------------------------------
#-sending data
C:DATA
-Subject: test clmfd30 (Checking dynamic override)
+Subject: Very Simple email contents
FIRST Line
SECOND Line
#define OPEP "lvleml.c:getdata,"
_Bool done;
+char *line;
+_Bool empty;
+int got;
int phase;
_Bool proceed;
done=false;
+line=(char *)0;
+empty=false;
+got=0;
phase=0;
proceed=true;
while (proceed==true) {
- //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
+ (void) rou_alert(0,"JMPDBG %s phase='%d' empty='%d'",OPEP,phase,empty);
switch (phase) {
case 0 : //Do we have a parameter
(void) transmit(contact,"%d 3.5.0 %s",
DATAOK,"End data with <CR><LF>.<CR><LF>");
break;
+ case 1 : //get incoming line
+ got=tcp_getline(contact->socptr,WAITLINE,&line);
+ if (got<=0) { //data timeout
+ }
+ break;
+ case 2 : //just display line
+ (void) rou_alert(0,"%s, data=<%s>",OPEP,line);
+ if ((empty==false)||(strcmp(line,".")!=0))
+ phase=0; //Wait for next line
+ empty=false;
+ if (strlen(line)==0)
+ empty=true;
+ line=rou_freestr(line);
+ break;
+ case 3 : //got all data
+ (void) rou_alert(0,"JMPDBG transmit OK");
+ (void) transmit(contact,"%d 3.5.3 %s",
+ CMDOK,"Message accepted for delivery");
+ break;
default : //SAFE guard
proceed=false;
break;
return code;
#undef OPEP
}
+
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to remove crlf at the end of the */
+/* return true if CRLF was removed */
+/* */
+/********************************************************/
+PUBLIC int eml_removecrlf(char *string)
+
+{
+_Bool done;
+
+done=false;
+if (string!=(char *)0) {
+ register int taille;
+ register char *ptr;
+
+ taille=strlen(string)-1;
+ ptr=string+taille;
+ while ((*ptr=='\n') || (*ptr=='\r')) {
+ *ptr='\000';
+ taille--;
+ done=true;
+ if (taille<0)
+ break;
+ ptr--;
+ }
+ }
+return done;
+}
+
//convert SMTP keyword to CODTYP
extern CODTYP eml_getcode(char *keyword);
+//remove CRLF from string
+extern int eml_removecrlf(char *string);
+
#endif