webalizer是一个简单易用的日志分析软件,但安装好中文版本后,出来的图表中总有让人心烦的乱码。本文用一个简单的perl处理脚本就可让乱码不再出现。 #!/usr/bin/perl $file_graph = "$ARGV[0]/graphs.c"; if(!(-e $file_graph)) { print "error open $file_graph "; print "Usage: perl $0 DIR "; #DIR是源文件目录,比如 ./ exit; } #把图表中的月份和注释改成英文 @old_var = ("msg_h_hits", "msg_h_pages", "msg_h_visits", "msg_h_files", "msg_h_sites", "msg_h_xfer", "s_month"); @new_var = ("msg_gh_hits", "msg_gh_pages", "msg_gh_visits", "msg_gh_files", "msg_gh_sites", "msg_gh_xfer", "s_gmonth"); open(IN,"$file_graph"); for($i=0;$i$file_lang"); print OUT QQ~ /* --- start Add ---*/ char *msg_gh_hits = "Hits"; char *msg_gh_pages = "Pages"; char *msg_gh_visits= "Visits"; char *msg_gh_files = "Files"; char *msg_gh_sites = "Sites"; char *msg_gh_xfer = "KBytes"; char *s_gmonth[12]={ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; /* -------------End------------- */ ~; #补充声明这些新加的函数 print " patch $ARGV[0]/lang.h "; $file_lang = "$ARGV[0]/lang.h"; open(OUT,">>$file_lang"); print OUT qq~ /* --- start Add ---*/ extern char *msg_gh_hits ; extern char *msg_gh_pages ; extern char *msg_gh_visits; extern char *msg_gh_files ; extern char *msg_gh_sites ; extern char *msg_gh_xfer ; extern char *s_gmonth[12]; /* -------------End------------- */ ~; print "Done ^_^ "; ############################################################
[1] [2] 下一页
(出处:http://www.sheup.com)
上一页 [1] [2]