计算机软件著作权登记源代码范本Word下载.docx
《计算机软件著作权登记源代码范本Word下载.docx》由会员分享,可在线阅读,更多相关《计算机软件著作权登记源代码范本Word下载.docx(82页珍藏版)》请在冰豆网上搜索。
dst/result.h>
#defineNS_MAIN1
named/ns_smf_globals.h>
#endif
#ifdefDLZ
dlz/dlz_drivers.h>
statictybs_boolean_twant_stats=TYBS_FALSE;
staticcharprogram_name[TYBS_DIR_NAMEMAX]="
named"
;
staticcharabsolute_conffile[TYBS_DIR_PATHMAX];
staticcharsaved_command_line[512];
staticcharversion[512];
staticunsignedintmaxsocks=0;
void
ns_main_earlywarning(constchar*format,...){
va_listargs;
va_start(args,format);
if(ns_g_lctx!
=NULL){
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_WARNING,format,args);
}else{
fprintf(stderr,"
%s:
"
program_name);
vfprintf(stderr,format,args);
\n"
);
fflush(stderr);
}
va_end(args);
Voidns_main_earlyfatal(constchar*format,...){
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,format,args);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,"
exiting(duetoearlyfatalerror)"
exit
(1);
staticvoid
assertion_failed(constchar*file,intline,tybs_assertiontype_ttype,
constchar*cond)
{
tybs_assertion_setcallback(NULL);
%d:
%s(%s)failed"
file,line,tybs_assertion_typetotext(type),cond);
exiting(duetoassertionfailure)"
%s(%s)failed\n"
file,line,tybs_assertion_typetotext(type),cond);
if(ns_g_coreok)
abort();
library_fatal_error(constchar*file,intline,constchar*format,va_listargs)TYBS_FORMAT_PRINTF(3,0);
library_fatal_error(constchar*file,intline,constchar*format,
va_listargs)
tybs_error_setfatal(NULL);
fatalerror:
"
file,line);
exiting(duetofatalerrorinlibrary)"
library_unexpected_error(constchar*file,intline,constchar*format,va_listargs)TYBS_FORMAT_PRINTF(3,0);
library_unexpected_error(constchar*file,intline,constchar*format,va_listargs)
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,"
unexpectederror:
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,format,args);
lwresd_usage(void){
fprintf(stderr,
usage:
lwresd[-4|-6][-cconffile|-Cresolvconffile]"
[-ddebuglevel]\n"
[-f|-g][-nnumber_of_cpus][-pport]"
[-Plisten-port][-s]\n"
[-tchrootdir][-uusername][-ipidfile]\n"
[-m{usage|trace|record|size|mctx}]\n"
usage(void){
if(ns_g_lwresdonly){
lwresd_usage();
return;
named[-4|-6][-cconffile][-ddebuglevel]"
[-f|-g][-nnumber_of_cpus]\n"
[-pport][-s][-tchrootdir][-uusername]\n"
staticvoidsave_command_line(intargc,char*argv[]){inti;
char*src;
char*dst;
char*eob;
constchartruncated[]="
..."
tybs_boolean_tquoted=TYBS_FALSE;
dst=saved_command_line;
eob=saved_command_line+sizeof(saved_command_line);
for(i=1;
i<
argc&
&
dst<
eob;
i++){
*dst++='
'
src=argv[i];
while(*src!
='
\0'
&
eob){
if(quoted||isalnum(*src&
0xff)||*src=='
-'
||*src=='
_'
.'
/'
){
*dst++=*src++;
quoted=TYBS_FALSE;
\\'
quoted=TYBS_TRUE;
INSIST(sizeof(saved_command_line)>
=sizeof(truncated));
if(dst==eob)
strcpy(eob-sizeof(truncated),truncated);
else
*dst='
staticintparse_int(char*arg,constchar*desc){
char*endp;
inttmp;
longintltmp;
ltmp=strtol(arg,&
endp,10);
tmp=(int)ltmp;
if(*endp!
)
ns_main_earlyfatal("
%s'
%s'
mustbenumeric"
desc,arg);
if(tmp<
0||tmp!
=ltmp)
outofrange"
return(tmp);
staticstructflag_def{
constchar*name;
unsignedintvalue;
}mem_debug_flags[]={
{"
trace"
TYBS_MEM_DEBUGTRACE},
record"
TYBS_MEM_DEBUGRECORD},
usage"
TYBS_MEM_DEBUGUSAGE},
size"
TYBS_MEM_DEBUGSIZE},
mctx"
TYBS_MEM_DEBUGCTX},
{NULL,0}
};
set_flags(constchar*arg,structflag_def*defs,unsignedint*ret){for(;
conststructflag_def*def;
constchar*end=strchr(arg,'
'
intarglen;
if(end==NULL)
end=arg+strlen(arg);
arglen=end-arg;
for(def=defs;
def->
name!
=NULL;
def++){if(arglen==(int)strlen(def->
name)&
memcmp(arg,def->
name,arglen)==0){*ret|=def->
value;
gotofound;
unrecognizedflag'
%.*s'
arglen,arg);
found:
if(*end=='
break;
arg=end+1;
parse_command_line(intargc,char*argv[]){
intch;
intport;
tybs_boolean_tdisable6=TYBS_FALSE;
tybs_boolean_tdisable4=TYBS_FALSE;
save_command_line(argc,argv);
tybs_commandline_errprint=TYBS_FALSE;
while((ch=tybs_commandline_parse(argc,argv,"
46c:
C:
d:
fgi:
lm:
n:
N:
p:
P:
sS:
t:
T:
u:
vVx:
))!
=-1){switch(ch){case'
4'
:
if(disable4)ns_main_earlyfatal("
cannotspecify-4and-6"
if(tybs_net_probeipv4()!
=TYBS_R_SUCCESS)ns_main_earlyfatal("
IPv4notsupportedbyOS"
tybs_net_disableipv6();
disable6=TYBS_TRUE;
break;
case'
6'
if(disable6)
if(tybs_net_probeipv6()!
IPv6notsupportedbyOS"
tybs_net_disableipv4();
disable4=TYBS_TRUE;
c'
ns_g_conffile=tybs_commandline_argument;
lwresd_g_conffile=tybs_commandline_argument;
if(lwresd_g_useresolvconf)
cannotspecify-cand-C"
ns_g_conffileset=TYBS_TRUE;
C'
lwresd_g_resolvconffile=tybs_commandline_argument;
if(ns_g_conffileset)
lwresd_g_useresolvconf=TYBS_TRUE;
d'
ns_g_debuglevel=parse_int(tybs_commandline_argument,
debuglevel"
f'
ns_g_foreground=TYBS_TRUE;
g'
ns_g_logstderr=TYBS_TRUE;
/*XXXBEW-ishouldberemoved*/
i'
lwresd_g_defaultpidfile=tybs_commandline_argument;
l'
ns_g_lwresdonly=TYBS_TRUE;
m'
set_flags(tybs_commandline_argument,mem_debug_flags,&
tybs_mem_debugging);
N'
/*Deprecated.*/
n'
ns_g_cpus=parse_int(tybs_commandline_argument,"
numberofcpus"
if(ns_g_cpus==0)
ns_g_cpus=1;
p'
port=parse_int(tybs_commandline_argument,"
port"
if(port<
1||port>
65535)ns_main_earlyfatal("
port'
tybs_commandline_argument);
ns_g_port=port;
/*XXXBEWShould-Pberemoved?
*/
P'
lwresd_g_listenport=port;
s'
want_stats=TYBS_TRUE;
S'
maxsocks=parse_int(tybs_commandline_argument,"
maxnumberofsockets"
t'
ns_g_chrootdir=tybs_commandline_argument;
T'
if(strcmp(tybs_commandline_argument,"
clienttest"
)==0)ns_g_clienttest=TYBS_TRUE;
elsefprintf(stderr,"
unknown-Tflag'
%s\n"
u'
ns_g_username=tybs_commandline_argument;
v'
printf("
BIND%s\n"
ns_g_version);
exit(0);
V'
BIND%sbuiltwith%s\n"
ns_g_version,ns_g_configargs);
?
'
usage();
if(tybs_commandline_option=='
unknownoption'
-%c'
tybs_commandline_option);
default:
parsingoptionsreturned%d"
ch);
argc-=tybs_commandline_index;
argv+=tybs_commandline_index;
if(argc>
0){
ns_main_earlyfatal("
extracommandlinearguments"
statictybs_result_t
create_managers(void){
tybs_result_tresult;
unsignedintsocks;
#ifdefTYBS_PLATFORM_USETHREADS
unsignedintcpus_detected;
#ifdefTYBS_PLATFORM_USETHREADScpus_detected=tybs_os_ncpus();
if(ns_g_cpus==0)
ns_g_cpus=cpus_detected;
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY