[docs][TT# 1667] Get rid of wrong documentation
[parrot.git] / tools / util / parrot-config.pir
blob40402663c0e9952646697f391ea854ab1a174805
1 #!/usr/bin/env parrot
2 # $Id$
4 =head1 NAME
6 config.pir - Print a Parrot configuration item
8 =head1 VERSION
10 version 0.01
12 =head1 SYNOPSIS
14   ./parrot parrot-config.pir VERSION
15   ./parrot parrot-config.pir ccflags
16   ./parrot parrot-config.pir --dump
18 =head1 DESCRIPTION
20 Print out configuration items.
22 =head1 AUTHOR
24 Leopold Toetsch E<lt>lt@toetsch.atE<gt>.
26 =head1 COPYRIGHT
28 Copyright (C) 2004-2009, Parrot Foundation.
30 =cut
32 .sub _main :main
33     .param pmc argv
34     .local int argc
35     argc = argv
36     if argc < 2 goto usage
37     .local pmc interp, conf_hash
38     .local string key
39     .include "iglobals.pasm"
40     interp = getinterp
41     conf_hash = interp[.IGLOBALS_CONFIG_HASH]
42     .local int i
43     i = 1
44 loop:
45     key = argv[i]
46     if key == '--help' goto usage
47     if key == '--dump' goto dump
48     $I0 = defined conf_hash[key]
49     unless $I0 goto failkey
50     dec argc
51     if i < argc goto dumpsome
52     $S0 = conf_hash[key]
53     print $S0
54     inc i
55     if i < argc goto loop
56     print "\n"
57     end
58 dumpsome:
59     key = argv[i]
60     $I0 = defined conf_hash[key]
61     unless $I0 goto failkey
62     print key
63     print " => '"
64     $S1 = conf_hash[key]
65     print $S1
66     say "'"
67     inc i
68     if i <= argc goto dumpsome
69     end
70 failkey:
71     print " no such key: '"
72     print key
73     print "'\n"
74     end
75 dump:
76    .local pmc iterator
77     iterator = iter conf_hash
78 iter_loop:
79     unless iterator goto iter_end
80     shift $S0, iterator
81     print $S0
82     print " => '"
83     $S1 = conf_hash[$S0]
84     print $S1
85     say "'"
86     goto iter_loop
87 iter_end:
88     end
89 usage:
90     $S0 = argv[0]
91     $P0 = getinterp
92     .include 'stdio.pasm'
93     $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
94     $P1.'print'($S0)
95     $P1.'print'(" [ <config-key> [ <config-key> ... ] | --dump | --help ]\n")
96     exit 1
97 .end
99 # Local Variables:
100 #   mode: pir
101 #   fill-column: 100
102 # End:
103 # vim: expandtab shiftwidth=4 ft=pir: