blob: 5b72652acb6a670a4b52f6c2ab0a3b84318e0e70 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#!/bin/sh -
# Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
# This file is part of the Linux-8086 C library and is distributed
# under the GNU Library General Public License.
main()
{
rm -f .config.tmp
ALLON=yes
if [ "$ALLON" = yes -a -f .config.lst ]
then grep '^[^:]*:+:' .config.lst > .config.tmp
[ -s .config.tmp ] && ALLON=no
fi
if [ "$ALLON" = yes -a -f Config.dflt ]
then grep '^[^:]*:+:' Config.dflt > .config.tmp
[ -s .config.tmp ] && {
ALLON=no
grep -q '^kinclude:' .config.tmp >/dev/null 2>&1 || {
[ -d "$ELKSSRC/include" ] ||
echo 'kinclude:+:' >> .config.tmp
}
}
fi
egrep -v '^#|^$' /dev/null */[Cc]onfig | \
sed -e 's./.:.' -e 's/[ ]*:[ ]*/:/g' >> .config.tmp 2>/dev/null
ls */Makefile | sed 's-/Makefile-:+:+-' >> .config.tmp
sort .config.tmp > .config.lst
unset_dups
if [ ! -s .config.lst ]
then echo 'No configuration options'
exit 0
fi
CHANGED=0
RUNNING=1
[ "$DIST" != "" -o ! -t 1 -o ! -t 0 ] && {
RUNNING=0
echo 'Using default configuration'
}
while [ $RUNNING = 1 ]
do
display
echo
echon 'Option to flip [or quit] >'
read n
v=""
case "$n" in
[qQ]* ) RUNNING=0
;;
[0-9] ) v=$n ;;
[0-9][0-9] ) v=$n ;;
* ) echo '\007'
;;
esac
if [ "$v" != "" ]
then set_option $v
fi
done
if [ "$CHANGED" = 1 -a \( -f libc.a -o -f crt0.o \) ]
then echo '
You should now run a "make clean" to clean out the libc.a
'
exit 1
fi
exit 0
}
display()
{
clear
echo 'Configuration options'
echo
awk -F: < .config.lst '{
if( $3 == "+" ) next;
if( $2 == "+" ) { flags[$1] = 1; next; }
printf("%2d) ", ++count);
if( $1 in flags ) printf("(ON) ");
else printf("(OFF) ");
if( $2 == "Config" ) printf(" "); else printf("* ");
printf("%s\n", $4);
}'
}
unset_dups()
{
awk -F: < .config.lst '{
if( $2 == "+" && $3 == "+") { if( noco[$1] != 1 ) noco[$1] = 2; next; }
if( $2 == "+" ) { flags[$1] = 1; next; }
if( "'$ALLON'" == "yes" && $2 == "Config" ) flags[$1] = 1;
if( $1 in flags )
{
if( $3 in gottype )
;
else
{
printf("%s:+:\n", $1);
gottype[$3] = 1;
}
}
noco[$1] = 1;
printf("%s\n", $0);
} END {
for(i in noco)
if( noco[i] == 2 )
printf("%s:+:+\n", i);
}' | sort > .config.tmp
ALLON=no
mv -f .config.tmp .config.lst
}
set_option()
{
rm -f .config.tmp1
awk -F: < .config.lst '{
if( $2 == "+" && $3 == "+" ) { print $0; next; }
if( $2 == "+" ) { flags[$1] = 1; next; }
if( ++cnt == '$1' )
{
if( $1 in flags )
;
else
printf("%s:+:\n", $1) > ".config.tmp1";
printf("%s\n", $0) > ".config.tmp1";
}
else
{
if( $1 in flags )
printf("%s:+:\n", $1);
printf("%s\n", $0);
}
}' > .config.tmp2
if [ -f .config.tmp1 ]
then CHANGED=1
else echo 'Cannot change that option!'
sleep 2
fi
cat .config.tmp[12] > .config.lst
rm .config.tmp[12]
unset_dups
}
echon() {
[ "$ECHON" = "" ] && {
if echo -n | grep -e -n >/dev/null
then ECHON="echo "; ECHOT='\c'
else ECHON="echo -n"; ECHOT=''
fi
}
$ECHON "$@""$ECHOT"
}
main
|