From 7fed20ed1fa62bd6b4d196cc5c4fb9bfed37944c Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Tue, 13 Aug 2024 05:44:02 -0400 Subject: [PATCH] Adding devlog module --- lib/Makefile | 9 +++++++-- lib/devlog.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/devlog.h | 14 ++++++++++++++ lib/lvleml.c | 4 ++-- lib/subrou.c | 2 +- lib/uniprc.c | 4 ++-- 6 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 lib/devlog.c create mode 100644 lib/devlog.h diff --git a/lib/Makefile b/lib/Makefile index 12d2978..183777d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -19,8 +19,8 @@ OBJS= \ modrec.o \ lvleml.o \ gestcp.o \ - devsoc.o \ - unieml.o \ + devlog.o devsoc.o \ + unieml.o \ unipar.o uniprc.o unisig.o unitls.o \ subrou.o @@ -49,6 +49,11 @@ gestcp.o: \ unisig.h \ gestcp.h gestcp.c +devlog.o: \ + subrou.h \ + uniprc.h \ + devlog.h devlog.c + devsoc.o: \ subrou.h \ unieml.h \ diff --git a/lib/devlog.c b/lib/devlog.c new file mode 100644 index 0000000..d3acbcf --- /dev/null +++ b/lib/devlog.c @@ -0,0 +1,49 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Log management implementation module */ +/* */ +/********************************************************/ +#include +#include + +#include "subrou.h" +#include "uniprc.h" +#include "devlog.h" + +static _Bool modopen; //boolean module open/close +/* +^L +*/ +/********************************************************/ +/* */ +/* Procedure to "open/close" module and do */ +/* homework purpose */ +/* return zero if everything right */ +/* */ +/********************************************************/ +PUBLIC int log_modedevlog(_Bool mode) + +{ +#define OPEP "devlog.c:log_modedevlog" + +int status; + +status=0; +if (mode!=modopen) { + switch ((int)mode) { + case true : + break; + case false : + break; + default : + (void) fprintf(stderr,"Calling %s with wrong mode='%d' (Bug?!):", + OPEP,(int)mode); + status=-1; + break; + } + modopen=mode; + } +return status; +#undef OPEP +} diff --git a/lib/devlog.h b/lib/devlog.h new file mode 100644 index 0000000..0592e4a --- /dev/null +++ b/lib/devlog.h @@ -0,0 +1,14 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/************************************************/ +/* */ +/* device level, logs management */ +/* declaration. */ +/* */ +/************************************************/ +#ifndef DEVLOG +#define DEVLOG + +//homework to be done before starting/stopping module. +extern int log_modedevlog(_Bool mode); + +#endif diff --git a/lib/lvleml.c b/lib/lvleml.c index 905f4d0..0727d4b 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -155,7 +155,7 @@ return done; /* Procedure to rset the current session */ /* */ /************************************************/ -static _Bool dorset(CONTYP *contact,char *keyword,char *parameter) +static _Bool doreset(CONTYP *contact,char *keyword,char *parameter) { (void) transmit(contact,"%d 2.0.0 Flushed session %s",CMDOK,contact->cursesid); @@ -217,7 +217,7 @@ while (proceed==true) { proceed=false; break; case c_rset : //Doing session reset - proceed=dorset(contact,line,parameter); + proceed=doreset(contact,line,parameter); break; case c_starttls : //EHLO start encryptel link switch (soc_starttls(contact->socptr,contact->peerip)) { diff --git a/lib/subrou.c b/lib/subrou.c index 044bd1a..11cf3e4 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.4.1" -#define RELEASE "3" +#define RELEASE "4" //Public variables PUBLIC int debug=0; //debug level diff --git a/lib/uniprc.c b/lib/uniprc.c index d84e7f3..311aec9 100644 --- a/lib/uniprc.c +++ b/lib/uniprc.c @@ -1,7 +1,7 @@ // vim: smarttab tabstop=8 shiftwidth=2 expandtab /********************************************************/ /* */ -/* Module for low level subroutine */ +/* Process management implementation module. */ /* */ /********************************************************/ #include @@ -498,7 +498,7 @@ if (setrlimit(RLIMIT_CORE,&limites)<0) { PUBLIC int prc_modeuniprc(_Bool mode) { -#define OPEP "unipar.c:prc_modeuniprc" +#define OPEP "uniprc.c:prc_modeuniprc" int status; -- 2.47.3