From: Jean-Marc Pigeon (Delson) Date: Sun, 18 Aug 2024 01:17:29 +0000 (-0400) Subject: Starting to scan dnstst file X-Git-Tag: tag-0.4.2-end~15 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=bc318d670a6d44d0b220fcc294d2998482c9367c;p=jmp%2Fmailleur Starting to scan dnstst file --- diff --git a/app/chkdns.c b/app/chkdns.c index 5f1a356..2cda539 100644 --- a/app/chkdns.c +++ b/app/chkdns.c @@ -5,6 +5,7 @@ /* library. */ /* */ /********************************************************/ +#include #include #include #include @@ -23,6 +24,35 @@ */ /********************************************************/ /* */ +/* Procedure to scan a line from the test file */ +/* */ +/********************************************************/ +static int scanline(FILE *fichier) + +{ +int status; +int num; +char line[300]; + +status=0; +num=0; +while (fgets(line,sizeof(line),fichier)!=(char *)0) { + char *ptr; + + num++; + if ((ptr=strchr(line,'#'))!=(char *)0) + *ptr='\000'; + if (strlen(line)==0) + continue; + (void) rou_alert(0,"JMPDBG line='%d' <%s>",num,line); + } +return status; +} +/* + +*/ +/********************************************************/ +/* */ /* Procedure to scan one file stop at soon test */ /* line is not successful. */ /* */ @@ -31,8 +61,38 @@ static int scantest(char *testfile) { int status; +char *rootname; +FILE *fichier; +int phase; +_Bool proceed; -status=0; +status=-1; +rootname=rou_apppath(testfile); +phase=0; +proceed=true; +while (proceed==true) { + switch (phase) { + case 0 : //using root directory if need + if ((fichier=fopen(rootname,"r"))==(FILE *)0) { + (void) rou_alert(0,"Unable to open file <%s> (error=<%s>)", + rootname,strerror(errno)); + phase=999; //no need to go further + } + break; + case 1 : //scan the file + (void) scanline(fichier); + break; + case 2 : //scan the file + (void) fclose(fichier); + status=0; + break; + default : //SAFE guard + proceed=false; + break; + } + phase++; + } +rootname=rou_freestr(rootname); return status; } /* @@ -101,6 +161,7 @@ while (proceed==true) { (void) prc_modeuniprc(true); (void) spf_modegesspf(true); (void) prc_preptitle(argc,argv,environ); + foreground=true; break; case 3 : //doing main tash (void) testfiles(params); diff --git a/lib/subrou.c b/lib/subrou.c index 6be2ead..a159a2d 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.4.2" -#define RELEASE "20" +#define RELEASE "21" //Public variables PUBLIC int debug=0; //debug level