summaryrefslogtreecommitdiff
path: root/support/splint/scripts/misccw.pl
blob: a0c53b19c9449c5c947af0b6777b5e33af90d05d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/perl

# Copyright 2012-2022, Alexander Shibakov
# This file is part of SPLinT
#
# SPLinT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SPLinT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SPLinT.  If not, see <http://www.gnu.org/licenses/>.

use Getopt::Long;
use Pod::Usage;

my $man = 0;
my $help = 0;
my $alpha_list = 0;
my $alpha_length = 1;

#Getopt::Long::Configure ("bundling"); # to allow -abc to set a, b, and c

GetOptions ("help|?" => \$help, 
            man => \$man,
            "alpha-list" => \$alpha_list,
            "alpha-length=i" => \$alpha_length
    ) or pod2usage(2);

pod2usage(-exitval => 0, -verbose => 1) if $help;
pod2usage(-exitval => 0, -verbose => 2) if $man;

if ( $alpha_list ) {
    open FILE_OUT, ">$ARGV[0]" or die "Cannot open input file $ARGV[0]\n";
    
    $alphabet = "abcdefghijklomnopqrstuvwxyz";
    
    @alpha_chars = split //, $alphabet;

    foreach $letter ( @alpha_chars ) {
        $letter_array[0] = $letter;
        for ( $i = 1; $i < $alpha_length; $i++ ) {
            $letter_array[$i] = '!';
        }
        $string = join '', @letter_array;
        print FILE_OUT "\@!\@:".$string."\@>\n";
    }   
}

__END__

=head1 MISCCW

misccw.pl - Miscellaneous functions

=head1 SYNOPSIS

misccw.pl [options] [input_file] [output_file]


 Options:
   --help|-h|-?      brief help message
   --man|-m          full documentation
   --alpha-list      generate a list of alphabetic markers

=head1 OPTIONS

=over 8

=item B<--help>

Print a brief help message and exit.

=item B<--man>

Print the manual page and exit.

=item B<--alpha-list>

Output a list of markers of the form @:?????@> in <output_file>

=back

=head1 DESCRIPTION

B<misccw.pl> will possibly read the given <input_file>, and likely output 
something in the <output_file> depending on the options given.

=cut