From e72503eea0947434e8b12594aa4e227799a97b5e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 18 Jul 2007 03:17:03 +0000 Subject: [PATCH] Use strict and all warnings. Simplify parsing. Add "@c End:" line to output to suppress Emacs warning. From bug #19335. Reviewed by John Darrington. --- doc/ChangeLog | 6 ++++++ doc/get-commands.pl | 27 ++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e6353227..80eec83a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-07-17 Ben Pfaff + + * get-commands.pl: Use strict and all warnings. Simplify + parsing. Add "@c End:" line to output to suppress Emacs warning. + From bug #19335. Reviewed by John Darrington. + 2007-06-05 Ben Pfaff * Removed next, prev, up node names from @node lines, to make diff --git a/doc/get-commands.pl b/doc/get-commands.pl index 7b6b2b58..68a53b94 100755 --- a/doc/get-commands.pl +++ b/doc/get-commands.pl @@ -1,32 +1,25 @@ #!/usr/bin/perl # Creates Texinfo documentation from the source -$file = $ARGV[0]; +use strict; +use warnings 'all'; + +my ($file) = $ARGV[0]; open(INFO, $file) || die "Cannot open \"$file\"\n" ; print "\@c Generated from $file by get-commands.pl\n"; print "\@c Do not modify!\n\n"; print "\@table \@asis\n"; -while ($line = ) +while () { - if ( $line =~ /^UNIMPL_CMD/ ) - { - @fields = split(/,/,$line); - $_ = $fields[0]; - s/^UNIMPL_CMD//; - s/ *\(\"// ; - s/\"//; - $command = $_; - $_=$fields[1]; - s/^ *\"//; - s/\"\)//; - chomp; - $description = $_; - print "\@item $command\n$description\n\n"; - } + my ($command, $description) + = /^\s*UNIMPL_CMD\s*\(\s*"([^"]*)"\s*,\s*"([^"]*)"\)\s*$/ + or next; + print "\@item $command\n$description\n\n"; } print "\@end table\n"; print "\@c Local Variables:\n"; print "\@c buffer-read-only: t\n"; +print "\@c End:\n"; close(INFO); # Close the file -- 2.30.2