3 #=======================================================================
5 # File ID: 775685f4-9acf-11e2-a914-0016d364066c
9 # ©opyleft 2013– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
33 $progname =~ s/^.*\/(.*?)$/$1/;
34 our $VERSION = '0.00';
36 Getopt
::Long
::Configure
('bundling');
39 'debug' => \
$Opt{'debug'},
40 'help|h' => \
$Opt{'help'},
41 'verbose|v+' => \
$Opt{'verbose'},
42 'version' => \
$Opt{'version'},
43 'zero|z' => \
$Opt{'zero'},
45 ) || die("$progname: Option error. Use -h for help.\n");
47 $Opt{'debug'} && ($Debug = 1);
48 $Opt{'help'} && usage
(0);
49 if ($Opt{'version'}) {
61 $Opt{'zero'} && ($/ = "\x00");
63 while (my $fname = <>) {
65 printf("<a href=\"%s\">%s</a><br />\n",
66 txt2html
($fname), txt2html
($fname));
85 # Print program version {{{
86 print("$progname v$VERSION\n");
92 # Send the help message to stdout {{{
95 if ($Opt{'verbose'}) {
101 Read filenames from stdin or files specified on the command line and
102 turn them into <a href="FILE">FILE</a><br />.
104 Usage: $progname [options] [file [files [...]]]
111 Increase level of verbosity. Can be repeated.
113 Filenames are separated with a null byte instead of linefeed.
115 Print version information.
117 Print debugging messages.
125 # Print a status message to stderr based on verbosity level {{{
126 my ($verbose_level, $Txt) = @_;
128 if ($Opt{'verbose'} >= $verbose_level) {
129 print(STDERR
"$progname: $Txt\n");
136 # Print a debugging message {{{
138 my @call_info = caller;
139 chomp(my $Txt = shift);
140 my $File = $call_info[1];
142 $File =~ s
#^.*/(.*?)$#$1#;
143 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
150 # Plain Old Documentation (POD) {{{
160 [options] [file [files [...]]]
170 =item B<-h>, B<--help>
172 Print a brief help summary.
174 =item B<-v>, B<--verbose>
176 Increase level of verbosity. Can be repeated.
180 Print version information.
184 Print debugging messages.
194 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
198 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
199 This is free software; see the file F<COPYING> for legalese stuff.
203 This program is free software: you can redistribute it and/or modify it
204 under the terms of the GNU General Public License as published by the
205 Free Software Foundation, either version 2 of the License, or (at your
206 option) any later version.
208 This program is distributed in the hope that it will be useful, but
209 WITHOUT ANY WARRANTY; without even the implied warranty of
210 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
211 See the GNU General Public License for more details.
213 You should have received a copy of the GNU General Public License along
215 If not, see L<http://www.gnu.org/licenses/>.
223 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :