软件著作权-源代码范本_第1页
软件著作权-源代码范本_第2页
软件著作权-源代码范本_第3页
软件著作权-源代码范本_第4页
软件著作权-源代码范本_第5页
已阅读5页,还剩48页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、软件著作权-源代码范本注意事项:常见的源代码包含:C语言,VB,C+,JAVA,.NET等。提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不等出现开源代码,不解曲现仔何版权纠纷。格式要求:-一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。范例如下:# include#inelude# include# inelude#inelude#include#include#incl

2、ude#include#include#include#include#include#include#include#include#include#include#include#defineNS_MAIN1#include#endif#ifdefDLZ#include#endifstatictybs_boolean_twant_stats=TYBS_FALSE;static char static char static char static charstatic unsigned int voidprogram_nameTYBS_DIR_NAMEMAX=named”;absolute

3、_conf;saved_command_line512;version512;maxsocks=0;ns_main_earlywarning(constchar*format5.)vajistargs;va_start(args,format);if(nsglctx!=NULL)tybs_log_vwrite(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_WARNING,format,args);elsefprintf(stderr,s:“,program_name);vfprintf(stderr,format,args)

4、;fprintf(stderr,n);fflush(stderr);va_end(args);)Voidns_main_earlyfatal(constchar*format,.)vajistargs;va_start(args,format);if(nsglctx!=NULL)tybs_log_vwrite(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,format,args);tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,

5、TYBS_LOG_CRITICAL,exiting(duetoearlyfatalerror);elsefprintf(stderr,s:“,program_name);vfprintf(stderr,format,args);fprintf(stderr,Hnlf);fflush(stderr);va_end(args);exit(1);)staticvoidassertion_failed(constchar*file,intline,tybs_assertiontype_ttype,constchar*cond)if(nsglctx!=NULL)tybs_assertion_setcal

6、lback(NULL);tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,*%s:%d:%s(%s)failed,file,line,tybs_assertion_typetotext(type),cond);tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,exiting(duetoassertionfailure)”);elsefprintf(stderr,%s:%

7、d:%s(%s)failednH,file,line,tybs_assertion_typetotext(type),cond);fflush(stderr);if(nsgcoreok)abort();exit;)staticvoidlibrary_fatal_error(constchar*file,intline,constchar*format,vajistargs)TYBS_FORMAT_PRINTF(3,0);staticvoidlibrary_fatal_error(constchar*file,intline,constchar*format,vajistargs)if(nsgl

8、ctx!=NULL)tybs_error_setfatal(NULL);tybsjog_write(nsgjctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,n%s:%d:fatalerror:,file,line);tybs_log_vwrite(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,format,args);tybsjog_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE

9、_MAIN,TYBS_LOG_CRITICAL,exiting(duetofatalerrorinlibrary),1);elsefprintf(stderr,n%s:%d:fatalerror:,file,line);vfprintf(stderr,format,args);fprintf(stderr,Hn);fflush(stderr);if(nsgcoreok)abort();exit;)staticvoidlibrary_unexpected_error(constchar*file,intline,constchar*format,vajistargs)TYBS_FORMAT_PR

10、INTF(3,0);staticvoidlibrary_unexpected_error(constchar*file,intline,constchar*format,vajistargs)if(nsgjctx!=NULL)tybs_log_write(nsgjctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,n%s:%d:unexpectederror:1,file,line);tybs_log_vwrite(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LO

11、G_ERROR,format,args);elsefprintf(stderr,H%s:%d:fatalerror:f,file,line);vfprintf(stderr,format,args);fprintf(stderr,MnH);fflush(stderr);)staticvoidlwresd_usage(void)fprintf(stderr,usage:Iwresd-4|-6-cconffile|-Cresolvconffilen-ddebugleveln”-f|-g-nnumber_of_cpus-pportHn-Plisten-port-sn”-tchrootdir-uuse

12、rname-ipidfilen”-musage|trace|record|size|mctxnH);)staticvoidusage(void)if(nsglwresdonly)lwresd_usage();return;fprintf(stderr,Husage:named-4|-6-cconffile-ddebuglevelnH-f|-g-nnumber_of_cpusnH”-pport-s-tchrootdir-uusemamenH”-musage|trace|record|size|mctxnM);)staticvoidsave_command_line(intargc,char*ar

13、gv)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;iargc&dsteob;i+)*dst+=src=argvi;while(*src!=!0&dst=sizeof(truncated);if(dst=eob)strcpy(eob-sizeof(truncated),truncated);else*dst=f0;)

14、staticintparse_int(char*arg,constchar*desc)char*endp;inttmp;longintItmp;Itmp=strtol(arg,&endp510);tmp=(int)Itmp;if(*endp!=W)ns_main_earlyfatal(H%smustbenumeric”,desc,arg);if(tmpname!=NULL;def+)if(arglen=(int)strlen(def-name)&memcmp(arg,def-name,arglen)=0)*ret|=def-value;gotofound;ns_main_earlyfatal(

15、Hunrecognizedflag%.*s二arglen,arg);found:if(*end=0)break;arg=end+1;)staticvoidparse_command_line(intargc,char*argv)intch;intport;tybs_boolean_tdisables=TYBS_FALSE;tybs_boolean_tdisable4=TYBS_FALSE;save_command_line(argc,argv);tybs_commandline_errprint=TYBS_FALSE;while(ch=tybs_commandline_parse(argc,a

16、rgv,146c:C:d:fgi:lm:n:N:p:P:f,nsS:t:T:u:vVx:H)!=-1)switch(ch)case4:if(disable4)ns_main_earlyfatal(cannotspecify-4and-6M);if(tybs_net_probeipv4()!=TYBS_R_SUCCESS)ns_main_earlyfatal(HIPv4notsupportedbyOS);tybs_net_disableipv6();disables=TYBS_TRUE;break;case6:if(disable6)ns_main_earlyfatal(Hcannotspeci

17、fy-4and-6”);if(tybs_net_probeipv6()!=TYBS_R_SUCCESS)ns_main_earlyfatal(IPv6notsupportedbyOS);tybs_net_disableipv4();disable4=TYBS_TRUE;break;casec:nsgconffile=tybs_commandline_argument;lwresdgconffile=tybs_commandline_argument;if(lwresdguseresolvconf)ns_main_earlyfatal(ncannotspecify-cand-C);nsgconf

18、=TYBS_TRUE;break;caseCf:lwresdgresolvconffile=tybs_commandline_argument;if(nsgconf)ns_main_earlyfatal(ncannotspecify-cand-Cn);lwresdguseresolvconf=TYBS_TRUE;break;cased:nsgdebuglevel=parsejnt(tybs_commandline_argument3Hdebuglevel);break;caseT:nsgforeground=TYBS_TRUE;break;caseg:nsgforeground=TYBS_TR

19、UE;nsglogstderr=TYBS_TRUE;break;/*XXXBEW-ishouldberemoved*/casei:lwresd_g_defaultpidfile=tybs_commandline_argument;break;caseT:nsglwresdonly=TYBS_TRL)E;break;casem:set_flags(tybs_commandline_argument3mem_debug_flags,&tybs_mem_debugging);break;caseN:/*Deprecated.7caseh:nsgcpus=parse_int(tybs_commandl

20、ine_argument,HnumberofcpusH);if(nsgcpus=0)nsgcpus=1;break;casep:port=parse_int(tybs_commandline_argument,nportM);if(port65535)ns_main_earlyfatal(Hportoutofrange11,tybs_commandline_argument);ns_g_port=port;break;/*XXXBEWShould-Pberemoved?7caseP:port=parse_int(tybs_commandline_argument,nportM);if(port

21、65535)ns_main_earlyfatal(Hportoutofrange,tybs_commandline_argument);lwresdglistenport=port;break;cases:want_stats=TYBS_TRUE;break;caseS:maxsocks=parse_int(tybs_commandline_argument,Hmaxnumberofsockets”);break;caset:nsgchrootdir=tybs_commandline_argument;break;case T:if(strcmp(tybs_commandline_argume

22、nt,HclienttestH)=0)nsgclienttest=TYBS_TRUE;elsefprintf(stderr,f,unknown-Tflag%sntybs_commandline_argument);break;case U: nsgusername=tybs_commandline_argument;break;case V:printf(BIND%sn,nsgversion);exit(O);caseV*:printf(lfBIND%sbuiltwith%snf,nsgversion,nsgconfigargs);exit(O);case!?:usage();if(tybs_

23、commandline_option=?)exit(O);ns_main_earlyfatal(Hunknownoptiontybs_commandline_option);default:ns_main_earlyfatal(Hparsingoptionsreturned%dch);argc-=tybs_commandline_index;argv+=tybs_commandline_index;if(argc0)usage();ns_main_earlyfatal(Hextracommandlinearguments11);)statictybs_result_tcreate_manage

24、rs(void)tybs_result_tresult;unsignedintsocks;#ifdefTYBS_PLATFORM_USETHREADSunsignedintcpus_detected;#endif#ifdefTYBS_PLATFORM_USETHREADScpus_detected=tybs_os_ncpus();if(nsgcpus=0)nsgcpus=cpus_detected;tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOGJNFO,found%uCPU%s,using%u

25、workerthread%scpus_detected,cpus_detected=1?:s,nsgcpus,nsgcpus=1?”:f,sH);#elsensgcpus=1;#endifresult=tybs_taskmgr_create(nsgmctx,nsgcpus,0,&nsgtaskmgr);if(result!=TYBS_R_SL)CCESS)UNEXPECTED_ERROR(_FILE_,_LINE,Htybs_taskmgr_create()failed:%s,tybs_result_totext(result);return(TYBS_R_UNEXPECTED);result

26、=tybs_timermgr_create(nsgmctx,&nsgtimermgr);if(result!=TYBS_R_SUCCESS)UNEXPECTED_ERROR(_FILE_,LINE,”tybs_timermgr_create()failed:%s”,tybs_result_totext(result);return(TYBS_R_UNEXPECTED);result=tybs_socketmgr_create2(nsgmctx,&nsgsocketmgr,maxsocks);if(result!=TYBS_R_SUCCESS)UNEXPECTED_ERROR(_FILE_,_L

27、INE,”tybs_socketmgr_create()failed:%s,tybs_result_totext(result);return(TYBS_R_UNEXPECTED);result=tybs_socketmgr_getmaxsockets(nsgsocketmgr,&socks);if(result=TYBS_R_SUCCESS)tybsjog_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO,usingupto%usockets,socks);result=tybs_entropy_cr

28、eate(nsgmctx,&ns_g_entropy);if(result!=TYBS_R_SUCCESS)UNEXPECTED_ERROR(_FILE_,_LINE_,Htybs_entropy_create()failed:%s”,tybs_result_totext(result);return(TYBS_R_UNEXPECTED);result=tybs_hash_create(nsgmctx?nsgentropy,DNS_NAME_MAXWIRE);if(result!=TYBS_R_SUCCESS)UNEXPECTED_ERROR(_FILE_,_LINE_,Htybs_hash_

29、create()failed:%sH,tybs_result_totext(result);return(TYBS_R_UNEXPECTED);return(TYBS_R_SUCCESS);)staticvoiddestroy_managers(void)nsjwresd_shutdown();tybs_entropy_detach(&nsgentropy);if(nsgfallbackentropy!=NULL)tybs_entropy_detach(&nsgfallbackentropy);tybs_taskmgr_destroy(&nsgtaskmgr);tybs_timermgr_de

30、stroy(&nsgtimermgr);tybs_socketmgr_destroy(&nsgsocketmgr);tybs_hash_destroy();)staticvoidsetup(void)tybs_result_tresult;#ifdefHAVE_LIBSCFchar*instance=NULL;#endifns_os_inituserinfo(nsgusemame);ns_os_tzset();ns_os_opendevnull();#ifdefHAVE_LIBSCFresult=ns_smf_get_instance(&instance,0,nsgmctx);if(resul

31、t=TYBS_R_SUCCESS)ns_smf_got_instance=1;elsens_smf_got_instance=0;if(instance!=NULL)tybs_mem_free(nsgmctx,instance);#endif/*HAVE_LIBSCF*/#ifdefPATH_RANDOMDEVif(nsgchrootdir!=NULL)result=tybs_entropy_create(nsgmctx,&nsgfallbackentropy);if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(tybs_entropy_create()

32、failed:%s,tybs_result_totext(result);result=tybs_entropy_create(nsgfallbackentropy,PATH_RANDOMDEV);if(result!=TYBS_R_SUCCESS)ns_main_earlywarning(couldnotopenpre-chroot“entropysource%s:%sf,PATH_RANDOMDEV,tybs_result_totext(result);tybs_entropy_detach(&nsgfallbackentropy);)#endifns_os_chroot(nsgchroo

33、tdir);ns_os_minprivs();result=ns_log_init(TYBS_TF(nsgusername!=NULL);if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(ns_log_init()failed:%s,tybs_result_totext(result);if(!nsgforeground)ns_os_daemonize();result=tybs_app_start();if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(Htybs_app_start()failed:%s,tybs

34、_result_totext(resuIt);tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE,“startingBIND%s%sH,nsgversion,saved_command_line);tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE,“builtwith%s,f,nsgconfigargs);(void)tybs_resource_getlimit(tybs_res

35、ource_stacksize,&nsginitstacksize);(void)tybs_resource_getlimit(tybs_resource_datasize,&nsginitdatasize);(void)tybs_resource_getlimit(tybs_resource_coresize,&nsginitcoresize);(void)tybs_resource_getlimit(tybs_resource_openfiles,&nsginitopenfiles);if(!tybs_(nsgconffile)result=tybs_(nsgconffiIe,absolu

36、te_conffile,sizeof(absolute_conffile);if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(Hcouldnotconstructabsolutepathof”configurationfile:%s,tybs_result_totext(result);ns_g_conffile=absolute_conffile;一result=tybs_time_now(&ns_g_boottime);if(result!=TYBsJr_SUCCESS)ns_main_earlyfatal(Htybs_time_now()faile

37、d:%sH,tybs_result_totext(result);result=create_managers();if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(Hcreate_managers()failed:%stybs_result_totext(result);ns_builtin_init();#ifdefDLZresult=dlz_drivers_init();if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(dlz_drivers_init()failed:%s,tybs_result_totex

38、t(result);#endifns_server_create(nsgmctx5&nsgserver);)staticvoidcleanup(void)destroy_managers();ns_server_destroy(&ns_builtin_deinit();#ifdefDLZdlz_drivers_clear();#endifdns_name_destroy();tybs_log_write(nsglctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE,exiting);ns_log_shutdown();stat

39、icchar*memstats=NULL;voidns_main_setmemstats(constchar*)if(memstats!=NULL)free(memstats);memstats=NULL;if(=NULL)return;memstats=malloc(strlen()+1);if(memstats)strcpy(memstats,);#ifdefHAVE_LIBSCFtybs_result_tns_smf_get_instance(char*ins_name,intdebug,tybs_mem_t*mctx)scf_handle_t*h=NULL;intnamelen;cha

40、r*instance;REQUIRE(ins_name!=NULL&*ins_name=NULL);if(h=scf_handle_create(SCF_VERSION)=NULL)if(debug)UNEXPECTED_ERROR(_FILE_,_LINE_,scf_handle_create()failed:%s,scf_strerror(scf_error();return(TYBS_R_FAILURE);if(scf_handle_bind(h)=-1)if(debug)UNEXPECTED_ERROR(_FILE_,_LINE_,scf_handle_bind()failed:%s”

41、,scf_strerror(scf_error();scf_handle_destroy(h);return(TYBS_R_FAILURE);if(namelen=scf_myname(h,NULL,0)=-1)if(debug)UNEXPECTED_ERROR(_FILE_,_LINE_,scf_myname()failed:%s,scf_strerror(scf_error();scf_handle_destroy(h);return(TYBS_R_FAILURE);if(instance=tybs_mem_allocate(mctx,namelen+1)=NULL)UNEXPECTED_

42、ERROR(_FILE_,_LINE_,ns_smf_get_instancememoryMallocationfailed:%s,tybs_result_totext(TYBS_R_NOMEMORY);scf_handle_destroy(h);return(TYBS_R_FAILURE);if(scf_myname(h3instance,namelen+1)=-1)if(debug)UNEXPECTED_ERROR(_FILE_,_LINE_,nscf_myname()failed:%s”,scf_strerror(scf_error();scf_handle_destroy(h);tyb

43、s_mem_free(mctx,instance);return(TYBS_R_FAILURE);scf_handle_destroy(h);*ins_name=instance;return(TYBS_R_SUCCESS);#endifintmain(intargc,char*argv)tybs_result_tresult;#ifdefHAVE_LIBSCFchar*instance=NULL;#endifstrlcat(versior),#ifdef_DATE_namedversion:BIND,fVERSION(HDATE”),#elsenamedversion:BIND,fVERSI

44、ON,#endifsizeof(version);result=tybs_(*argv,program_name,sizeof(program_name);if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(Hprogramnametoolong);if(strcmp(program_name3f,lwresdM)=0)ns_g_lwresdonly=TYBS_TRL)E;tybs_assertion_setcallback(assertion_failed);tybs_error_setfatal(library_fatal_error);tybs_er

45、ror_setunexpected(library_unexpected_error);ns_os_init(program_name);dns_result_register();dst_result_register();tybscc_result_register();parse_command_line(argc5argv);if(nsgchrootdir!=NULL)intlen=strlen(nsgchrootdir);if(strncmp(nsgchrootdir,nsgconffile,len)=0&(ns_g_conf=7f|nsgconf=)ns_main_earlywar

46、ning(f,config(-c%s)containsf,Hchrootpath(-t%s)n,nsgconffile,nsgchrootdir);result=tybs_mem_create(0,0,&nsgmctx);if(result!=TYBS_R_SUCCESS)ns_main_earlyfatal(tybs_mem_create()failed:%s,tybs_result_totext(result);tybs_mem_setname(nsgmctx,f,mainH,NULL);setup();doresult=tybs_app_run();if(result=TYBS_R_RE

47、LOAD)ns_server_reloadwanted(nsgserver);elseif(result!=TYBS_R_SUCCESS)UNEXPECTED_ERROR(_FILE,LINE,ftybs_app_run():%s,f,tybs_result_totext(resuIt);result=TYBS_R_SUCCESS;while(result!=TYBS_R_SUCCESS);#ifdefHAVE_LIBSCFif(ns_smf_want_disable=1)result=ns_smf_get_instance(&instance,1,nsgmctx);if(result=TYB

48、S_R_SUCCESS&instance!=NULL)if(smf_disable_instance(instance,0)!=0)UNEXPECTED_ERROR(_FILE,LINEsmf_disable_instance()failedfor%s:%sn,instance,scf_strerror(scf_error();jif(instance!=NULL)tybs_mem_free(nsgmctx,instance);#endif/*HAVE_LIBSCF7cleanup();if(want_stats)tybs_mem_stats(nsgmctx,stdout);tybs_mute

49、x_stats(stdout);if(nsgmemstatistics&memstats!=NULL)FILE*fp=NULL;result=tybs_stdio_open(memstats,Hw&fp);if(result=TYBS_R_SUCCESS)tybs_mem_stats(nsgmctx,fp);tybs_mutex_stats(fp);tybs_stdio_close(fp);tybs_mem_destroy(&nsgmctx);tybs_mem_checkdestroyed(stderr);ns_main_setmemstats(NULL);tybs_app_finish();

50、ns_os_closedevnull();ns_os_shutdown();return(0);#defineZENDJNCLUDE_FULL_WINDOWS_HEADERS#includephp.h#include#include#ifdefPHP_WIN32includewin32/time.hincludewin32/signal.hH#includewin32/php_win32_globals.h#include#elifdefined(NETWARE)#include#ifdefUSE_WINSOCK#include#endif#endif#ifHAVE_SYS_TIME_H#in

51、clude#endif#ifHAVE_UNISTD_H#include#endif#ifHAVE_SIGNAL_H#include#endif#ifHAVE_SETLOCALE#include#endif#includezend.h#includeHzend_extensions.hf,#includephpjni.h#includephp_globals.h#includeHphp_main.hH#includeHfopen_wrappers.hH#includenext/standard/php_standard.hH#includenphp_variables.hH#includeHext/standard/credits.hH#ifdefPHP_WIN32#include#includewin32/php_registry.h#includeHext/standard/flock_compat.hn#endif#includeHphp_syslog.hf,#includenZend/zend_exceptions.hn#ifPHP_SIGCHILD-#include#include#endif#includeHzend_compile.hH#includeHzend_execut

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论