#Equivalences
#--------------------------------------------------------------------
EXE= \
+ chkspf \
emlrcvr \
feeder \
- chkspf \
+ sorter \
SRC= \
+ chkspf.c \
emlrcvr.c \
freeder.c \
- chkspf.c \
+ sorter.c \
#--------------------------------------------------------------------
#definitions
#--------------------------------------------------------------------
#Dependances
#--------------------------------------------------------------------
+chkspf : toremake chkspf.o
+ @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
+
emlrcvr : toremake emlrcvr.o
@ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
feeder : toremake feeder.o
@ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
-chkspf : toremake chkspf.o
+sorter : toremake sorter.o
@ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
chkspf.o: chkspf.c \
../lib/unipar.h \
../lib/subrou.h
+sorter.o: sorter.c \
+ ../lib/subrou.h
+
toremake: Makefile $(LIBAI)
touch toremake
- rm -f $(EXE) *.o
--- /dev/null
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+/********************************************************/
+/* */
+/* SMTP protocol feeder. */
+/* Used to transmit data to remote SMTP server. */
+/* */
+/* Format is: */
+/* feeder ip port [file1 file2...] */
+/* */
+/********************************************************/
+#include <stdlib.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "subrou.h"
+#include "unisig.h"
+#include "unipar.h"
+
+#define SORTER "sorter" //application name
+
+/********************************************************/
+/* */
+/* procedure to scan all files */
+/* */
+/********************************************************/
+static _Bool scantrans()
+
+{
+_Bool status;
+
+status=false;
+(void) sleep(2);
+(void) rou_alert(0,"JMPDBG sorter");
+(void) sleep(5);
+status=true;
+return status;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Main routine */
+/* Start a channel to a remote ip.port */
+/* read file and transmit contecnts to */
+/* remote SMTP server. */
+/* */
+/********************************************************/
+int main(int argc,char *argv[])
+
+{
+int status;
+ARGTYP *params;
+int phase;
+_Bool proceed;
+
+status=0;
+params=(ARGTYP *)0;
+foreground=true;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ //(void) fprintf(stdout,"JMPDBG main phase='%d'\n",phase);
+ switch (phase) {
+ case 0 : //checking parameters
+ if ((params=par_getparams(argc,argv,"c:d:fhi:r:v"))==(ARGTYP *)0) {
+ proceed=false; //no need to go further
+ }
+ break;
+ case 1 : //Preparing scan
+ (void) rou_modesubrou(true);
+ (void) sig_modeunisig(true);
+ (void) rou_setappname(SORTER);
+ (void) rou_loadconfig(config,true);
+ (void) openlog(appname,LOG_NDELAY|LOG_PID,LOG_DAEMON);
+ (void) closelog();
+ break;
+ case 2 : //Scanning all file
+ if ((hangup==true)||(reload==true))
+ phase=999; //Process
+ if (scantrans()==false)
+ phase=999;
+ (void) sleep(5);
+ break;
+ default : //end of task
+ params=par_freeparams(params);
+ (void) rou_loadconfig(config,false);
+ (void) sig_modeunisig(false);
+ (void) rou_modesubrou(false);
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+(void) exit(status);
+}