-
Notifications
You must be signed in to change notification settings - Fork 1
/
set-config.pl
executable file
·46 lines (35 loc) · 1.04 KB
/
set-config.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -w
# This file should be called as:
# ./set-config.pl [--parallel] [--ncurses] [--graphics] [--verbose]
# By default, each of the three options (parallel, ncurses, graphics) will be
# turned off. Specify these options to explicitly turn them on. Specifying
# --verbose will display the contents of the generated config file.
my $parallel = 0;
my $curses = 0;
my $graphics = 0;
my $verbose = 0;
foreach (@ARGV) {
$parallel = 1 if m/^-*parallel$/;
$curses = 1 if m/^-*n?curses$/;
$graphics = 1 if m/^-*graphics$/;
$verbose = 1 if m/^-*v(erbose)?$/;
}
open(CONFIG, "<config");
my @config = <CONFIG>;
close(CONFIG);
@config = grep !/USEPARALLEL|USENCURSES/, @config;
unshift
@config,
("export USEPARALLEL = " . ($parallel ? "true\n" : "false\n")),
("export USENCURSES = " . ($curses ? "true\n" : "false\n"));
# ("export USEGRAPHICS = " . ($graphics ? "true\n" : "false\n"));
if ($verbose) {
foreach (@config) {
print $_;
}
}
open(CONFIG, ">config");
foreach (@config) {
print CONFIG $_;
}
close(CONFIG);