From 602347425e1817d564fe0c4a7d9e40c703833443 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Sun, 16 Nov 2025 14:41:23 -0500 Subject: [PATCH] Testing rou_dbglive procedure --- lib/modrec.c | 2 +- lib/subrou.c | 21 +++++++++++++++------ lib/subrou.h | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/modrec.c b/lib/modrec.c index 5cdfe08..f5cc511 100644 --- a/lib/modrec.c +++ b/lib/modrec.c @@ -175,7 +175,7 @@ intstat=0; phase=0; proceed=true; while (proceed==true) { - (void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase); + (void) rou_dbglive(0,OPEP,"%s phase='%d'",phase); switch (phase) { case 0 : //waiting contact if ((contact=eml_getcontact(socptr,pos))==(CONTYP *)0) diff --git a/lib/subrou.c b/lib/subrou.c index 6e88a3c..b692765 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -634,15 +634,24 @@ if (debug>=dlevel) { /* function. */ /* */ /********************************************************/ -PUBLIC void rou_dbglive(const int dlevel,const char *fmt,...) +PUBLIC void rou_dbglive(const int dlevel,const char *prcref,const char *fmt,...) { -if (debug>=dlevel) { - va_list args; +#define DBG "DBGLIVE" - va_start(args,fmt); - (void) rou_valert(dlevel,fmt,args); - va_end(args); +char *ptr; + +if ((debug>=dlevel)&&((ptr=getenv(DBG))!=(char *)0)) { + if (strstr(ptr,prcref)!=(char *)0) { + char *nstr; + va_list args; + + (void) rou_asprintf(&nstr,"%s: %s",prcref,fmt); + va_start(args,fmt); + (void) rou_valert(dlevel,nstr,args); + va_end(args); + (void) free(nstr); + } } } /* diff --git a/lib/subrou.h b/lib/subrou.h index 42b9c96..18a7f79 100644 --- a/lib/subrou.h +++ b/lib/subrou.h @@ -106,7 +106,7 @@ void rou_valert(const int dlevel,const char *fmt,va_list ap); extern void rou_alert(const int dlevel,const char *fmt,...); //procedure to debug live daemon process -extern void rou_dbglive(const int dlevel,const char *fmt,...); +extern void rou_dbglive(const int dlevel,const char *prcref,const char *fmt,...); //To do an on purpose crash the application with an //explication message -- 2.47.3