* t/configure/25-options_test.t:
[parrot.git] / parrot-config
blob42fe28c4b9f23a6ce9534df816540d906c59f686
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-2006, The Perl 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 == '--dump' goto dump
47     $I0 = defined conf_hash[key]
48     if $I0 goto ok2
49     print " no such key: '"
50     print key
51     print "'\n"
52     end
53 ok2:
54     $S0 = conf_hash[key]
55     print $S0
56     inc i
57     if i < argc goto loop
58     print "\n"
59     end
60 dump:
61    .local pmc iter
62     .include "iterator.pasm"
63     new iter, .Iterator, conf_hash
64     iter = .ITERATE_FROM_START
65 iter_loop:
66     unless iter goto iter_end
67     shift $S0, iter
68     print $S0
69     print " => '"
70     $S1 = conf_hash[$S0]
71     print $S1
72     print "'\n"
73     goto iter_loop
74 iter_end:
75     end
76 usage:
77     $S0 = argv[0]
78     printerr $S0
79     printerr ": config-key\n"
80     exit 1
81 .end