Making 2 requests in main() of host.c instead of just 1

Joe Flowers flowers at social.chass.ncsu.edu
Thu Nov 21 10:59:09 UTC 2002


Apologies to anyone getting this message twice.

Need help please. I'm stuck. The first part of this program works fine, but
I need the second part to work too. The problem seems to be that the program
is not reinitializing correctly. Help please.

***The key part of the problem is how can I completely reinitialize HOST (or
BIND or whatever) so that I can make (and get the correct results of) two
"host" requests in the same thread?

Thank You!

Joe

Code snippets below:
//--------------------------------------------------------------------------
char *argvX[10]= {0,0,0,0,0,0,0,0,0,0};

int main(int argc, char *argv[]) {

char *argv1 = "-T\0";
char *argv2 = "-t\0";
char *argv3 = "txt\0";
char *argv4 = "-c\0";
char *argv5 = "hs\0";
char *argv6 = ".passwd.ns.eos.ncsu.edu\0";
char *argv7 = "152.1.1.206\0"; //ns3.ncsu.edu

char *argv8 = "user1\0";  //Request info for this user in the 1st half of
the program - OK.
char *argv9 = "user2\0"; //Request info for this user in the 2nd half of the
program - Does NOT work :-(

ISC_LIST_INIT(lookup_list);
ISC_LIST_INIT(server_list);
ISC_LIST_INIT(search_list);

result = isc_app_start();
check_result(result, "isc_app_start");
setup_libs();

argvX[0]="xJx\0";
argvX[1]=argv1;
argvX[2]=argv2;
argvX[3]=argv3;
argvX[4]=argv4;
argvX[5]=argv5;

strcpy(hostname, argv8); //***user1***
strcat(hostname, argv6);
argv6=hostname;
argvX[6]=argv6;

argvX[7]=argv7;

parse_args(ISC_FALSE, 7, argvX);

setup_system();

result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
check_result(result, "isc_app_onrun");

result=isc_app_run();

cancel_all();
destroy_libs();
isc_app_finish();

//THE PROGRAM WORKS FINE TO HERE, BUT THE NEXT PART DOES NOT WORK.
//"HOST" is not re-initializing correctly and or completely.

char *argv1 = "-T\0";
char *argv2 = "-t\0";
char *argv3 = "txt\0";
char *argv4 = "-c\0";
char *argv5 = "hs\0";
char *argv6 = ".passwd.ns.eos.ncsu.edu\0";
char *argv7 = "152.1.1.206\0"; //ns3.ncsu.edu

char *argv8 = "user1\0";  //Request info for this user in the 1st half of
the program - OK.
char *argv9 = "user2\0"; //Request info for this user in the 2nd half of the
program - Does NOT work :-(

ISC_LIST_INIT(lookup_list);
ISC_LIST_INIT(server_list);
ISC_LIST_INIT(search_list);

result = isc_app_start();
check_result(result, "isc_app_start");
setup_libs();

argvX[0]="xJx\0";
argvX[1]=argv1;
argvX[2]=argv2;
argvX[3]=argv3;
argvX[4]=argv4;
argvX[5]=argv5;

strcpy(hostname, argv9); //***user2***
strcat(hostname, argv6);
argv6=hostname;
argvX[6]=argv6;

argvX[7]=argv7;

parse_args(ISC_FALSE, 7, argvX);

setup_system();

result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
check_result(result, "isc_app_onrun");

result=isc_app_run();

cancel_all();
destroy_libs();
isc_app_finish();

return 0;
}
//-------------------------------------------------------------
//END.




More information about the bind-workers mailing list