⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gen

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻
字号:
#!/usr/bin/perlsystem("grep 'define NETSNMP_DS_' ../../../include/net-snmp/agent/ds_agent.h > ds_agent.h");system("h2xs -n NetSNMP::agent::default_store -O ds_agent.h");open(ORIG,"default_store.xs");open(NEW,"NetSNMP/agent/default_store/default_store.xs");open(OUT,">default_store_new.xs");# get up to the include from the original filewhile(<ORIG>) {    print OUT;    last if (/include <net-snmp\/agent\/ds_agent.h/);}# skip up to the include from the original filewhile(<NEW>) {    last if (/include <ds_agent.h>/);}# include the entire new fileprint OUT <NEW>;close(OUT);## generate test#open(H,"ds_agent.h");open(ORIG,"test.pl");open(OUT,">test.pl.new");while(<ORIG>) {    print OUT;    last if (/\%tests =/);}while(<H>) {    if (/define\s+(\w+)\s+(\d+)/) {	printf OUT ("                  %-40s => %d,\n", "\"$1\"", $2);	$tokenlist .= "				   $1\n";    }}while(<ORIG>) {    last if (/\);/);}print OUT;print OUT <ORIG>;close(OUT);## modify the perl module itself#open(ORIG,"default_store.pm");open(OUT,">default_store_new.pm");# first listwhile(<ORIG>) {    print OUT;    last if (/\%EXPORT_TAGS =/);}print OUT $tokenlist;while(<ORIG>) {    last if (/\) \] \);/);}print OUT;# second listwhile(<ORIG>) {    print OUT;    last if (/\@EXPORT =/);}print OUT $tokenlist;while(<ORIG>) {    last if (/\);/);}print OUT;# last sectionwhile(<ORIG>) {    print OUT;    last if (/head2 Exportable constants/);}print OUT "\n";print OUT $tokenlist;while(<ORIG>) {    last if (/^\s*$/);}print OUT;# tail endprint OUT <ORIG>;close(OUT);## install new files#print "updated test.pl\n";rename("test.pl","test.pl.bak");rename("test.pl.new","test.pl");print "updated default_store.pm\n";rename("default_store.pm", "default_store.pm.bak");rename("default_store_new.pm", "default_store.pm");print "updated default_store.xs\n";rename("default_store.xs", "default_store.xs.bak");rename("default_store_new.xs", "default_store.xs");## remove the temp files.#system("rm -rf NetSNMP");unlink("ds_agent.h");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -