l*******G 发帖数: 1191 | 1 想要把程序的patch 转成html 格式,这样code 的前后变化一目了然,便于交流,
却找不到合适的工具,
找到了一个patch2html.pl
http://david.decotigny.free.fr/snippets/patch2html.pl
下载后,运行却出错,程序很短,这里全贴出来,高手们试一试,看能否解决。(我想
很可能是程序经http下载后个别特殊字符出了问题。
错误信息如下:
Name "main::FH" used only once: possible typo at
patch2html.pl line 312.
Use of uninitialized value $string in substitution (s///)patch2html.pl line 71, line 2.
Use of uninitialized value $string in substitution (s///) patch2html.pl line 76, line 2.
---原程序 ------------------------- |
t*****g 发帖数: 1275 | 2 那些问号是什么?是不是下载的时候编码没搞对?utf/iso字符搞乱了?
line 71, line 2.
【在 l*******G 的大作中提到】 : 想要把程序的patch 转成html 格式,这样code 的前后变化一目了然,便于交流, : 却找不到合适的工具, : 找到了一个patch2html.pl : http://david.decotigny.free.fr/snippets/patch2html.pl : 下载后,运行却出错,程序很短,这里全贴出来,高手们试一试,看能否解决。(我想 : 很可能是程序经http下载后个别特殊字符出了问题。 : 错误信息如下: : Name "main::FH" used only once: possible typo at : patch2html.pl line 312. : Use of uninitialized value $string in substitution (s///)patch2html.pl line 71, line 2.
|
l*******G 发帖数: 1191 | 3
是一个特殊符号,
用vi 看的结果是 §
确实很奇怪,还有就是Code 中的空格或者tab 建都有可能丢失了 |
C********s 发帖数: 120 | 4 Looks like you ran the program like this:
patch2html.pl some.html
while you should run it like this:
patch2html.pl
It readds the input from STDIN, not a file name |
m*********g 发帖数: 273 | 5 To read this kind of PERL is a tough job. |
l*******G 发帖数: 1191 | 6 I have changed the code slightly by removing the strange characters, which should be either / or &
And also I thought it should be executed like:
Firstly generate the patch:
diff code1.c code2.c > patchfile
Then run the code:
chmod a+x patch2html_new.pl
patch2html_new.pl patchfile > output.html
Now it is complaining like this:
======================
./patch2html_new.pl patchfile
Use of uninitialized value $string in substitution (s///) at ./patch2html_
new.pl line 73, line 1.
Use of un |
C********s 发帖数: 120 | 7 faint, still don't see the "main" is only one line at the end of the script??
dodiff_stdin();
if read input from the STDIN, not a file name, so you need to run it like
this:
patch2html.pl |
l*******G 发帖数: 1191 | 8 Good,
Also did a little search and found it's most relevant successor:
http://www.freebsd.org/cgi/cvsweb.cgi/projects/cvsweb/cvsweb.cgi?rev=1.297;content-type=text%2Fplain
where most of the parts are written into the infamous cvsweb program
http://www.freebsd.org/projects/cvsweb.html (latest version)
http://www.freebsd.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi (old version)
I'm not interested in cvsweb or any cgi application here. Hopefully with the
two codes to compare about, I can finally make |