6 # collect lines continued with a '\' into an array
16 last unless (/\\\s*$/);
21 # regex && eval away unwanted strings from documentation
24 $text =~ s/USAGE_\w+\([\s]*?(".*?").*?\)/$1/sg;
25 $text =~ s/"[\s]*"//sg;
26 my @line = split("\n", $text);
29 map { qq[ sprintf(qq#$_#) ] }
41 # generate POD for an applet
46 my $trivial = $usage->{trivial};
47 $trivial =~s/(?<!\w)(-\w+)/B<$1>/sxg;
51 map { $_ !~ /^\s/ && s/(?<!\w)(-\w+)/B<$1>/g; $_ }
52 split("\n", $usage->{full}));
55 "-------------------------------\n".
66 # generate SGML for an applet
74 # the keys are applet names, and
75 # the values will contain hashrefs of the form:
83 # get command-line options
94 if (defined $opt{help}) {
96 "$0 [OPTION]... [FILE]...\n",
105 # collect documenation into %docs
107 open(USAGE, $_) || die("$0: $!");
109 my ($applet, $type, @line);
112 if (/^#define (\w+)_(\w+)_usage/) {
115 @line = continuation($fh);
116 my $doc = $docs{$applet} ||= { };
118 my $text = join("\n", @line);
119 $doc->{$type} = beautify($text);
126 #print Data::Dumper->Dump([\%docs], [qw(docs)]);
128 foreach my $name (sort keys %docs) {
129 print pod_for_usage($name, $docs{$name});
138 autodocifier.pl - generate docs for busybox based on usage.h
142 autodocifier.pl usage.h > something
146 The purpose of this script is to automagically generate documentation
147 for busybox using its usage.h as the original source for content.
148 Currently, the same content has to be duplicated in 3 places in
149 slightly different formats -- F<usage.h>, F<docs/busybox.pod>, and
150 F<docs/busybox.sgml>. This is tedious, so Perl has come to the rescue.
152 This script was based on a script by Erik Andersen (andersen@lineo.com).
156 these control my behaviour
162 This displays the help message.
168 files that I manipulate
172 Copyright (c) 2001 John BEPPU. All rights reserved. This program is
173 free software; you can redistribute it and/or modify it under the same
174 terms as Perl itself.
178 John BEPPU <beppu@lineo.com>
182 # $Id: autodocifier.pl,v 1.4 2001/02/23 03:12:45 beppu Exp $