软件著作权源代码.docx
- 文档编号:29679857
- 上传时间:2023-07-26
- 格式:DOCX
- 页数:120
- 大小:43.55KB
软件著作权源代码.docx
《软件著作权源代码.docx》由会员分享,可在线阅读,更多相关《软件著作权源代码.docx(120页珍藏版)》请在冰豆网上搜索。
软件著作权源代码
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#defineNS_MAIN1
#include
#endif
#ifdefDLZ
#include
#endif
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);
fprintf(stderr,"\n");
fflush(stderr);
}
va_end(args);
}
Voidns_main_earlyfatal(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_CRITICAL,
format,args);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"exiting(duetoearlyfatalerror)");
}else{
fprintf(stderr,"%s:
",program_name);
vfprintf(stderr,format,args);
fprintf(stderr,"\n");
fflush(stderr);
}
va_end(args);
exit
(1);
}
staticvoid
assertion_failed(constchar*file,intline,tybs_assertiontype_ttype,
constchar*cond)
{
if(ns_g_lctx!
=NULL){
tybs_assertion_setcallback(NULL);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"%s:
%d:
%s(%s)failed",file,line,
tybs_assertion_typetotext(type),cond);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"exiting(duetoassertionfailure)");
}else{
fprintf(stderr,"%s:
%d:
%s(%s)failed\n",
file,line,tybs_assertion_typetotext(type),cond);
fflush(stderr);
}
if(ns_g_coreok)
abort();
exit
(1);
}
staticvoid
library_fatal_error(constchar*file,intline,constchar*format,
va_listargs)TYBS_FORMAT_PRINTF(3,0);
staticvoid
library_fatal_error(constchar*file,intline,constchar*format,
va_listargs)
{
if(ns_g_lctx!
=NULL){
tybs_error_setfatal(NULL);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"%s:
%d:
fatalerror:
",file,line);
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(duetofatalerrorinlibrary)");
}else{
fprintf(stderr,"%s:
%d:
fatalerror:
",file,line);
vfprintf(stderr,format,args);
fprintf(stderr,"\n");
fflush(stderr);
}
if(ns_g_coreok)
abort();
exit
(1);
}
staticvoid
library_unexpected_error(constchar*file,intline,constchar*format,
va_listargs)TYBS_FORMAT_PRINTF(3,0);
staticvoid
library_unexpected_error(constchar*file,intline,constchar*format,
va_listargs)
{
if(ns_g_lctx!
=NULL){
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,
"%s:
%d:
unexpectederror:
",file,line);
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,
format,args);
}else{
fprintf(stderr,"%s:
%d:
fatalerror:
",file,line);
vfprintf(stderr,format,args);
fprintf(stderr,"\n");
fflush(stderr);
}
}
staticvoid
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");
}
staticvoid
usage(void){
if(ns_g_lwresdonly){
lwresd_usage();
return;
}
fprintf(stderr,
"usage:
named[-4|-6][-cconffile][-ddebuglevel]"
"[-f|-g][-nnumber_of_cpus]\n"
"[-pport][-s][-tchrootdir][-uusername]\n"
"[-m{usage|trace|record|size|mctx}]\n");
}
staticvoid
save_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 *dst++=''; src=argv[i]; while(*src! ='\0'&&dst if(quoted||isalnum(*src&0xff)|| *src=='-'||*src=='_'|| *src=='.'||*src=='/'){ *dst++=*src++; quoted=TYBS_FALSE; }else{ *dst++='\\'; quoted=TYBS_TRUE; } } } INSIST(sizeof(saved_command_line)>=sizeof(truncated)); if(dst==eob) strcpy(eob-sizeof(truncated),truncated); else *dst='\0'; } staticint parse_int(char*arg,constchar*desc){ char*endp; inttmp; longintltmp; ltmp=strtol(arg,&endp,10); tmp=(int)ltmp; if(*endp! ='\0') ns_main_earlyfatal("%s'%s'mustbenumeric",desc,arg); if(tmp<0||tmp! =ltmp) ns_main_earlyfatal("%s'%s'outofrange",desc,arg); 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} }; staticvoid 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; } } ns_main_earlyfatal("unrecognizedflag'%.*s'",arglen,arg); found: if(*end=='\0') break; arg=end+1; } } staticvoid 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) ns_main_earlyfatal("cannotspecify-4and-6"); if(tybs_net_probeipv6()! =TYBS_R_SUCCESS) ns_main_earlyfatal("IPv6notsupportedbyOS"); tybs_net_disableipv4(); disable4=TYBS_TRUE; break; case'c': ns_g_conffile=tybs_commandline_argument; lwresd_g_conffile=tybs_commandline_argument; if(lwresd_g_useresolvconf) ns_main_earlyfatal("cannotspecify-cand-C"); ns_g_conffileset=TYBS_TRUE; break; case'C': lwresd_g_resolvconffile=tybs_commandline_argument; if(ns_g_conffileset) ns_main_earlyfatal("cannotspecify-cand-C"); lwresd_g_useresolvconf=TYBS_TRUE; break; case'd': ns_g_debuglevel=parse_int(tybs_commandline_argument, "debuglevel"); break; case'f': ns_g_foreground=TYBS_TRUE; break; case'g': ns_g_foreground=TYBS_TRUE; ns_g_logstderr=TYBS_TRUE; break; /*XXXBEW-ishouldberemoved*/ case'i': lwresd_g_defaultpidfile=tybs_commandline_argument; break; case'l': ns_g_lwresdonly=TYBS_TRUE; break; case'm': set_flags(tybs_commandline_argument,mem_debug_flags, &tybs_mem_debugging); break; case'N': /*Deprecated.*/ case'n': ns_g_cpus=parse_int(tybs_commandline_argument, "numberofcpus"); if(ns_g_cpus==0) ns_g_cpus=1; break; case'p': port=parse_int(tybs_commandline_argument,"port"); if(port<1||port>65535) ns_main_earlyfatal("port'%s'outofrange", tybs_commandline_argument); ns_g_port=port; break; /*XXXBEWShould-Pberemoved? */ case'P': port=parse_int(tybs_commandline_argument,"port"); if(port<1||port>65535) ns_main_earlyfatal("port'%s'outofrange", tybs_commandline_argument); lwresd_g_listenport=port; break; case's': want_stats=TYBS_TRUE; break; case'S': maxsocks=parse_int(tybs_commandline_argument, "maxnumberofsockets"); break; case't': ns_g_chrootdir=tybs_commandline_argument; break; case'T': if(strcmp(tybs_commandline_argument,"clienttest")==0) ns_g_clienttest=TYBS_TRUE; else fprintf(stderr,"unknown-Tflag'%s\n", tybs_commandline_argument); break; case'u': ns_g_username=tybs_commandline_argument; break; case'v': printf("BIND%s\n",ns_g_version); exit(0); case'V': printf("BIND%sbuiltwith%s\n",ns_g_version, ns_g_configargs); exit(0); case'? ': usage(); if(tybs_commandline_option=='? ') exit(0); ns_main_earlyfatal("unknownoption'-%c'", tybs_commandline_option); default: ns_main_earlyfatal("parsingoptionsreturned%d",ch
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 软件 著作权 源代码