chiark / gitweb /
f8a6294db3faa72101eebf191ce78c0a074fbe64
[elogind.git] / klibc / makeklcc.pl
1 #!/usr/bin/perl
2 #
3 # Combine klibc.config, klcc.in to produce a klcc script
4 #
5 # Usage: makeklcc klcc.in klibc.config perlpath
6 #
7
8 ($klccin, $klibcconf, $perlpath) = @ARGV;
9
10 print "#!${perlpath}\n";
11
12 open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n";
13 while ( defined($l = <KLIBCCONF>) ) {
14     chomp $l;
15     if ( $l =~ /^([^=]+)\=(.*)$/ ) {
16         $n = $1;  $s = $2;
17         print "\$$n = \"\Q$s\E\";\n";
18         print "\@$n = qw($s);\n";
19         print "\$conf{\'\L$n\E\'} = \\\$$n;\n";
20     }
21 }
22 close(KLIBCCONF);
23
24 open(KLCCIN, '<', $klccin) or die "$0: cannot open $klccin: $!\n";
25 while ( defined($l = <KLCCIN>) ) {
26     print $l;
27 }
28 close(KLCCIN);
29