X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Fget-commands.pl;h=7d5ac4534b5c215c625fb63323ef674e6bfd2090;hb=21642f4f6a9e51d508d05aa003d3de112af7cdf2;hp=7b6b2b581db9d2e2e3e7596f8ae7e6e68871c7ad;hpb=85cef9b9391f1aaf4b27bd90a02f8ce5daf004ee;p=pspp diff --git a/doc/get-commands.pl b/doc/get-commands.pl index 7b6b2b581d..7d5ac4534b 100755 --- a/doc/get-commands.pl +++ b/doc/get-commands.pl @@ -1,32 +1,25 @@ #!/usr/bin/perl -# Creates Texinfo documentation from the source +# Creates Texinfo documentation from the source -$file = $ARGV[0]; -open(INFO, $file) || die "Cannot open \"$file\"\n" ; +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 \@cmd{$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