installed_progs.t: Python checks stdout too, 150 ok
[sunny256-utils.git] / lag3d
blobbe95fcd9df40fb88f18b3bf07d6aa1cf33cb83dd
1 #!/usr/bin/env perl
3 #=======================================================================
4 # lag3d
5 # File ID: 0a5321d2-5d3e-11df-86cd-90e6ba3022ac
6 # [Description]
8 # Character set: UTF-8
9 # ©opyleft 2004– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License, see end of file for legal stuff.
11 #=======================================================================
13 use strict;
14 use warnings;
15 use Getopt::Long;
17 $| = 1;
19 our ($opt_help, $opt_two) =
20 ( 0, 0);
22 my $VERSION = "0.0";
24 our $progname = $0;
25 $progname =~ s#^.*/(.*?)$#$1#;
27 Getopt::Long::Configure("bundling");
28 GetOptions(
29 "help|h" => \$opt_help,
30 "2" => \$opt_two
31 ) || die("$progname: Option error. Use -h for help.\n");
33 $opt_help && usage(0);
35 my $Count = 1;
36 my $Buf = "";
37 my $per_line = $opt_two ? 2 : 3;
39 while (<>) {
40 my $Curr = $_;
41 $Curr =~ s/\s+/\t/g;
42 $Curr =~ s/(\S+)/pr_num($1)/gse;
45 sub pr_num {
46 my $Num = shift;
47 $Buf .= ("$Num\t");
48 ($Count++ % $per_line) || print("$Buf\n", $Buf = "");
49 return("");
52 sub usage {
53 # Send the help message to stdout {{{
54 my $Retval = shift;
55 print(<<END);
57 $progname v$VERSION
59 Usage: $progname [options] [file [files [...]]]
61 Options:
63 -h, --help Show this help.
64 -2 Generate two columns instead of three.
66 END
67 exit($Retval);
68 # }}}
71 __END__
73 # Plain Old Documentation (POD) {{{
75 =pod
77 =head1 NAME
81 =head1 SYNOPSIS
85 =head1 DESCRIPTION
89 =head1 OPTIONS
91 =over 4
93 =item B<-h>, B<--help>
95 Print a brief help summary.
97 =item B<-2>
99 Generate two columns instead of three.
101 =back
103 =head1 BUGS
107 =head1 AUTHOR
109 Made by Øyvind A. Holm S<E<lt>sunny _AT_ sunbase.orgE<gt>>.
111 =head1 COPYRIGHT
113 Copyleft © Øyvind A. Holm &lt;sunny@sunbase.org&gt;
114 This is free software; see the file F<COPYING> for legalese stuff.
116 =head1 LICENCE
118 This program is free software; you can redistribute it and/or modify it
119 under the terms of the GNU General Public License as published by the
120 Free Software Foundation; either version 2 of the License, or (at your
121 option) any later version.
123 This program is distributed in the hope that it will be useful, but
124 WITHOUT ANY WARRANTY; without even the implied warranty of
125 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
126 See the GNU General Public License for more details.
128 You should have received a copy of the GNU General Public License along
129 with this program; if not, write to the Free Software Foundation, Inc.,
130 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
132 =head1 SEE ALSO
134 =cut
136 # }}}
138 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
139 # End of file lag3d