#!/usr/bin/perl -w # configen.pl -- automatic config file parser generator written for frox. # Needs a template file (in C), and a variable definitions file. # This is the only perl program I have ever written, and it probably shows. if (scalar @ARGV !=3) { print STDERR "Usage $0 defs template output\n"; exit 1; } open DEFS, $ARGV[0] or die "Can't open definitions file: $!"; open TEMPLATE, $ARGV[1] or die "Can't open template file: $!"; open OUTPUT, ">$ARGV[2]" or die "Can't open output file: $!"; while(){ next unless /\S/; next if /^#/; chomp; push @defs, $_; } %i = ( "name" => 0, "type" => 1, "var" => 2, "cl" => 3, "reload" => 4, "needed" => 5, "default" => 6 ); while(