7 # Copyright (C) 2008 Pawel Dziepak
9 # This tool loads file that consist of configuration possibilities and asks
10 # user questions about each option. The purpose of the tool is the same as
11 # the nc_config, but this script does not need ncurses installed.
14 # Open configuration file
15 open (CONF_IN
, "scripts/config_options");
18 if ($ARGV[0] !~ /\Adef/) {
19 print "Configuration tool for Quarn OS $ARGV[0] (text version)\nCopyright (C) 2008 Pawel Dziepak\n\n";
22 # go through config config and ask questions
25 if ($line =~ /\Aname (.*)/) {
28 } elsif ($line =~ /\Alongname (.*)/) {
31 } elsif ($line =~ /\Aopts (.*)/) {
34 } elsif ($line =~ /\Ahelp (.*)/) {
38 $help = $name = $descr = $opts = "";
44 if ($opts =~ /(\A|\s)yes/) {
47 if ($opts =~ /(\A|\s)dyes/) {
51 if ($opts =~ /(\A|\s)module/) {
54 if ($opts =~ /(\A|\s)dmodule/) {
58 if ($opts =~ /(\A|\s)no/) {
61 if ($opts =~ /(\A|\s)dno/) {
69 if ($ARGV[0] !~ /\Adef/) {
70 print "Do you want to enable \"$descr\" [$usera]: ";
73 if ($ans !~ /(\w|\?)/) {
76 if ($ans =~ /\Ay/ && $opts =~ /yes/) {
77 push(@confout, "#define $name\t\t2\n");
78 } elsif ($ans =~ /\Am/ && $opts =~ /module/) {
79 push(@confout, "#define $name\t\t1\n");
80 } elsif ($ans =~ /\An/ && $opts =~ /no/) {
81 push(@confout, "#define $name\t\t0\n");
82 } elsif ($ans =~ /\A\?/) {
86 print "Unknown answer. ";
92 push(@confout, "\n#define CONF_NO\t\t\t0\n");
93 push(@confout, "#define CONF_MODULE\t\t1\n");
94 push(@confout, "#define CONF_YES\t\t2\n");
96 open (CONF_OUT
, ">quarnconf.h");
97 print CONF_OUT
@confout;