1
function SetUpServer() {
2
TopHeader = "<HTML><title>Remote Configuration</title>"
4
<h2>Please choose one of the following actions:</h2>\
6
<LI><A HREF=" MyPrefix "/AboutServer>About this server</A></LI>\
7
<LI><A HREF=" MyPrefix "/ReadConfig>Read Configuration</A></LI>\
8
<LI><A HREF=" MyPrefix "/CheckConfig>Check Configuration</A></LI>\
9
<LI><A HREF=" MyPrefix "/ChangeConfig>Change Configuration</A></LI>\
10
<LI><A HREF=" MyPrefix "/SaveConfig>Save Configuration</A></LI>\
12
TopFooter = "</BODY></HTML>"
13
if (ConfigFile == "") ConfigFile = "config.asc"
15
function HandleGET() {
16
if(MENU[2] == "AboutServer") {
17
Document = "This is a GUI for remote configuration of an\
18
embedded system. It is is implemented as one GAWK script."
19
} else if (MENU[2] == "ReadConfig") {
21
while ((getline < ConfigFile) > 0)
25
Document = "Configuration has been read."
26
} else if (MENU[2] == "CheckConfig") {
27
Document = "<TABLE BORDER=1 CELLPADDING=5>"
29
Document = Document "<TR><TD>" i "</TD>" \
30
"<TD>" config[i] "</TD></TR>"
31
Document = Document "</TABLE>"
32
} else if (MENU[2] == "ChangeConfig") {
33
if ("Param" in GETARG) { # any parameter to set?
34
if (GETARG["Param"] in config) { # is parameter valid?
35
config[GETARG["Param"]] = GETARG["Value"]
36
Document = (GETARG["Param"] " = " GETARG["Value"] ".")
38
Document = "Parameter <b>" GETARG["Param"] "</b> is invalid."
41
Document = "<FORM method=GET><h4>Change one parameter</h4>\
42
<TABLE BORDER CELLPADDING=5>\
43
<TR><TD>Parameter</TD><TD>Value</TD></TR>\
44
<TR><TD><input type=text name=Param value=\"\" size=20></TD>\
45
<TD><input type=text name=Value value=\"\" size=40></TD>\
46
</TR></TABLE><input type=submit value=\"Set\"></FORM>"
48
} else if (MENU[2] == "SaveConfig") {
50
printf("%s %s\n", i, config[i]) > ConfigFile
52
Document = "Configuration has been saved."