#include "subrou.h"
#include "subafn.h"
#include "unidns.h"
+#include "unipar.h"
+#include "uniprc.h"
#include "gesspf.h"
+#define CHKNAME "checkdns"
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to scan one file stop at soon test */
+/* line is not successful. */
+/* */
+/********************************************************/
+static int scantest(char *testfile)
+
+{
+int status;
+
+status=0;
+return status;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to scan filename present within the */
+/* parameter list */
+/* */
+/********************************************************/
+static int testfiles(ARGTYP *params)
+
+{
+int status;
+
+status=0;
+for (int i=0;i<params->argc;i++) {
+ (void) fprintf(stdout,"Doing test pattern <%s>\n",params->argv[i]);
+ (void) scantest(params->argv[i]);
+ }
+return status;
+}
/*
\f
*/
{
int status;
-int try;
-AFNTYP *afnnum;
-char *curname;
int phase;
+ARGTYP *params;
_Bool proceed;
status=0;
-try=0;
-afnnum=(AFNTYP *)0;
-if ((curname=strrchr(argv[0],'/'))==(char *)0)
- curname=argv[0];
-else
- curname++;
+params=(ARGTYP *)0;
phase=0;
proceed=true;
while (proceed==true) {
switch (phase) {
case 0 : //checking parameters
- foreground=true;
- debug=5;
- (void) rou_setappname(curname);
- if (argc<2) {
- (void) rou_alert(0,"%s need 2 arguments (domain,IP)",appname);
- for (int i=1;i<=argc;i++)
- (void) rou_alert(0,"\targ[%d]=<%s>",i,argv[i]);
- phase=999;
- }
+ if ((params=par_getparams(argc,argv,"d:hr:v"))==(ARGTYP *)0)
+ phase=999; //no need to go further
break;
- case 1 : //checking IP
- if ((afnnum=afn_getipnum(argv[2]))==(AFNTYP *)0) {
- (void) rou_alert(0,"%s is not an IP (aborting)",argv[2]);
+ case 1 : //check if we have file to scan
+ if (params->argc==0) {
+ (void) fprintf(stderr,"Unable to proceed with test\n");
+ (void) fprintf(stderr,"\tthe filenames (of test pattern) are missing\n");
+ status=-1;
phase=999;
}
break;
- case 2 : //initialisation
+ case 2 :
+ (void) rou_setappname(CHKNAME);
(void) afn_modesubafn(true);
(void) rou_modesubrou(true);
+ (void) par_modeunipar(true);
+ (void) prc_modeuniprc(true);
(void) spf_modegesspf(true);
+ (void) prc_preptitle(argc,argv,environ);
break;
case 3 : //doing main tash
- if (argc>1) { //always
- SPFENU spf;
-
- spf=spf_getstatus(&try,argv[1],afnnum);
- (void) rou_alert(0,"%s %s ==> %s",argv[1],argv[2],spf_spfASCII(spf));
- }
- afnnum=afn_freeipnum(afnnum);
+ (void) testfiles(params);
break;
case 4 : //doing main tash
+ (void) prc_cleantitle();
+ params=par_freeparams(params);
(void) spf_modegesspf(false);
+ (void) prc_modeuniprc(false);
+ (void) par_modeunipar(false);
(void) rou_modesubrou(false);
(void) afn_modesubafn(false);
break;