newtest : deltest
@ mkdir -p $(TESTDIR)/var/run
@ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/{in,out}-logs
+ @ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/queue
@ mkdir -p $(TESTDIR)/usr
@ cp -a \
bin \
//to compute an application path with the root directory
extern char *rou_apppath(const char *path);
+//to compute an application path with the root directory
+extern char *rou_apppath(const char *path);
+
//to display message on console (verbose mode) or
//via syslog (LOG_INFO) using variable argument list macros
void rou_valert(const int dlevel,const char *fmt,va_list ap);
/* exchange. */
/* */
/********************************************************/
+#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "subrou.h"
#include "unieml.h"
+#define QDIR "/var/spool/"APPNAME"/queue"
+
typedef struct {
CODTYP code; //keyword code
const char *key; //keyword itself
return code;
#undef OPEP
}
-
/*
^L
*/
}
return done;
}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to open a file to store the email in */
+/* within the spool queue. */
+/* */
+/********************************************************/
+PUBLIC FILE *eml_opennewqueue(char *sessionid)
+{
+#define OPEP "unieml.c:eml_opennewqueue,"
+
+FILE *fichier;
+char *filename;
+int phase;
+int proceed;
+
+fichier=(FILE *)0;
+filename=(char *)0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
+ switch (phase) {
+ case 0 : //Do we have a session ID
+ if ((sessionid=(char *)0)||(strlen(sessionid)==0)) {
+ (void) rou_core_dump("%s sessionID is not set (bug?)",OPEP);
+ phase=999; //never reached
+ }
+ break;
+ case 1 : //"Computing" the file new queue filename
+ filename=rou_apppath(QDIR);
+ filename=(char *)realloc(filename,strlen(filename)+strlen(sessionid)+10);
+ if ((fichier=fopen(filename,"w"))==(FILE *)0) {
+ (void) rou_alert(0,"%s Unable to open file <%s> (error=<%s>)",
+ OPEP,filename,strerror(errno));
+ }
+ filename=rou_freestr(filename);
+ break;
+ default : //SAFE guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+return fichier;
+}
#ifndef UNIEML
#define UNIEML
+#include <stdio.h>
+
#define MXMSIZE 52428800 //52 Megabytes
#define CRLF "\r\n" //EOL within SMTP protocol
#define SIGNON 220 //signon information
//remove CRLF from string
extern int eml_removecrlf(char *string);
+//procedure to open a queue file
+extern FILE *eml_opennewqueue(char *sessid);
+
+//procedure to open a queue file
+extern int eml_closenewqueue(FILE *queue);
+
#endif