From c287c78ddec0173e5310e046c5e6d595abe24407 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 24 Jan 2000 09:39:01 +0000 Subject: Create a tool for converting a config_h.SH into a VOS config.h. p4raw-id: //depot/cfgperl@4872 --- vos/config.pl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 vos/config.pl (limited to 'vos/config.pl') diff --git a/vos/config.pl b/vos/config.pl new file mode 100644 index 0000000000..33629d7081 --- /dev/null +++ b/vos/config.pl @@ -0,0 +1,48 @@ +# This file fills in a config_h.SH template based on the data +# of the file config.def and outputs a config.sh. + +if (open(CONFIG_DEF, "config.def")) { + while () { + if (/^([^=]+)='(.+)'$/) { + my ($var, $val) = ($1, $2); + $define{$var} = $val; + } else { + warn "config.def: $.: illegal line: $_"; + } + } +} else { + die "$0: Cannot open config.def: $!"; +} + +if (open(CONFIG_SH, "config_h.SH_orig")) { + while () { + last if /^sed <) { + last if /^!GROK!THIS!/; + s/\\\$Id:/\$Id:/; + s/\$package/perl5/; + s/\$cf_time/localtime/e; + s/\$myuname/$define{OSNAME}/; + s/\$seedfunc/$define{seedfunc}/; + if (/^#\$\w+\s+(\w+)/) { + if (exists $define{$1}) { + if ($define{$1} eq 'define') { + print "#define $1\t/**/\n"; + } else { + print "#define $1 $define{$1}\n"; + } + } else { + print "/*#define $1\t/**/\n"; + } + } elsif (/^#define\s+(\S+)/) { + print "#define $1 $define{$1}\n"; + } elsif (s/\$cpp_stuff/$define{cpp_stuff}/g) { + print; + } else { + print; + } + } +} else { + die "$0: Cannot open config_h.SH_orig: $!"; +} -- cgit v1.2.1