]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding devlog module
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 13 Aug 2024 09:44:02 +0000 (05:44 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 13 Aug 2024 09:44:02 +0000 (05:44 -0400)
lib/Makefile
lib/devlog.c [new file with mode: 0644]
lib/devlog.h [new file with mode: 0644]
lib/lvleml.c
lib/subrou.c
lib/uniprc.c

index 12d2978a2f88819930ae55180d6597a4645e6a79..183777dbbcf1803c7846084844c86b729eae9b76 100644 (file)
@@ -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 (file)
index 0000000..d3acbcf
--- /dev/null
@@ -0,0 +1,49 @@
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+/********************************************************/
+/*                                                     */
+/*     Log management implementation module            */
+/*                                                     */
+/********************************************************/
+#include        <stdbool.h>
+#include        <stdio.h>
+
+#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 (file)
index 0000000..0592e4a
--- /dev/null
@@ -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
index 905f4d0bc7708e2b9cbf4d6972f811d19ee7d7e5..0727d4b1a57dd3e70c622fb13aad5e36a4003975 100644 (file)
@@ -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)) {
index 044bd1ae995e37251279f5c74ee0dbf1485e06f5..11cf3e446d4c4053c15740f2866501911fbe18fe 100644 (file)
@@ -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
index d84e7f33c1645ce55f22137fd7475c783a73e796..311aec931ae107744fe1df3e426adbad0b24bc47 100644 (file)
@@ -1,7 +1,7 @@
 // vim: smarttab tabstop=8 shiftwidth=2 expandtab
 /********************************************************/
 /*                                                     */
-/*     Module for low level subroutine                 */
+/*     Process management implementation module.       */
 /*                                                     */
 /********************************************************/
 #include       <sys/prctl.h>
@@ -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;