From: <sg...@us...> - 2003-08-31 20:27:43
|
Update of /cvsroot/libfunutil/libfunutil/toc/bin In directory sc8-pr-cvs1:/tmp/cvs-serv20833/toc/bin Modified Files: atsign_parse Log Message: added support for include:KEY=PATH. Index: atsign_parse =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/bin/atsign_parse,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- atsign_parse 30 Aug 2003 19:20:30 -0000 1.2 +++ atsign_parse 31 Aug 2003 20:27:39 -0000 1.3 @@ -2,12 +2,16 @@ # ( ^^^^ when run with -n it tries to read in files named after the args. e.g. foo=bar) # # Takes command-line args in the format: -# foo=bar bar=foobar ... +# foo=bar [[include:]bar=foobar] ... # and parses stdin, replacing @foo@ with bar and @bar@ with foobar. # All output goes to stdout. # # Intended to be used as a simple parser for Makefile.in-type files. # +# Special key type: +# include:KEY=VAL +# will try to read the file VAL and import it in place of @KEY@. +# # Optional arguments: # [-f filename] will read in that file. It must be in the form KEY=VALUE, with one key/value per line. # [-c] will enable "cleanup mode". Any @TOKENS@ in the input stream which were not explicitely @@ -56,6 +60,13 @@ $val = $2; if( $STRIP_LEADING_DASHES ) { $key =~ s/^-+//; } #print STDERR ": [$key]=[$val]\n"; + if( $key =~ m|^include:(.+)| ) { + $key = $1; + open INFILE, "<$val" or die "Cannot open file '$val', as requested by @include:$key@!"; + @foo = <INFILE>; + close INFILE; + $val = join( "", @foo ); + } $args{$key} = $val; } } # /BEGIN |