Thursday, August 20, 2009

Minor bug in vim2html.pl

I'm not sure whether vim2html.pl is actually used (I notice there's an
awk version as well), but in trying to convert the documentation for
my plugin into html, I noticed a very minor bug in vim2html.pl. It
doesn't cause a problem for vim builds as multiple files are done at
once, but if you try to convert one file at a time, it fails.

The bug is on line 217 of the current CVS version:

usage() if $#ARGV < 2;

Usage includes:

vim2html.pl <tag file> <text files>

Pedantically speaking, the plural in "text files" does make it
relatively clear that there must be more than one, but it seems to
make sense that you could run:

perl vim2html.pl tags myvimdoc.txt

and expect it to work. However, "$#ARGV < 2" checks that there are at
least THREE arguments ($#ARGV is the highest index in the @ARGV
array). Shouldn't this be the following?

usage() if scalar(@ARGV) < 2;

This checks that there are at least TWO arguments (alternatively
"$#ARGV < 1" could be used, but I find this less clear).

Al

--
http://sites.google.com/site/abudden

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment