function SetUpServer() { TopHeader = "Remote Configuration" TopDoc = "\

Please choose one of the following actions:

\ " TopFooter = "" if (ConfigFile == "") ConfigFile = "config.asc" } function HandleGET() { if (MENU[2] == "AboutServer") { Document = "This is a GUI for remote configuration of an\ embedded system. It is is implemented as one GAWK script." } else if (MENU[2] == "ReadConfig") { RS = "\n" while ((getline < ConfigFile) > 0) config[$1] = $2; close(ConfigFile) RS = "\r\n" Document = "Configuration has been read." } else if (MENU[2] == "CheckConfig") { Document = "" for (i in config) Document = Document "" \ "" Document = Document "
" i "" config[i] "
" } else if (MENU[2] == "ChangeConfig") { if ("Param" in GETARG) { # any parameter to set? if (GETARG["Param"] in config) { # is parameter valid? config[GETARG["Param"]] = GETARG["Value"] Document = (GETARG["Param"] " = " GETARG["Value"] ".") } else { Document = "Parameter " GETARG["Param"] " is invalid." } } else { Document = "

Change one parameter

\ \ \ \ \
ParameterValue
" } } else if (MENU[2] == "SaveConfig") { for (i in config) printf("%s %s\n", i, config[i]) > ConfigFile close(ConfigFile) Document = "Configuration has been saved." } }