Fix minimal compilation

This commit is contained in:
Theo Arends 2021-05-03 12:49:41 +02:00
parent de1d580613
commit f0f6f94374
1 changed files with 8 additions and 8 deletions

View File

@ -420,6 +420,14 @@ static void WebGetArg(const char* arg, char* out, size_t max)
// out[max-1] = '\0'; // Ensure terminating NUL // out[max-1] = '\0'; // Ensure terminating NUL
} }
String AddWebCommand(const char* command, const char* webarg, const char* dflt) {
char arg[100]; // Allow parameter with lenght up to 99 characters
WebGetArg(webarg, arg, sizeof(arg));
char cmnd[120];
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (!strlen(arg)) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (strlen(arg) < 5)) ? "" : arg);
return String(cmnd);
}
static bool WifiIsInManagerMode(){ static bool WifiIsInManagerMode(){
return (HTTP_MANAGER == Web.state || HTTP_MANAGER_RESET_ONLY == Web.state); return (HTTP_MANAGER == Web.state || HTTP_MANAGER_RESET_ONLY == Web.state);
} }
@ -1975,14 +1983,6 @@ void HandleWifiConfiguration(void) {
WSContentStop(); WSContentStop();
} }
String AddWebCommand(const char* command, const char* webarg, const char* dflt) {
char arg[100]; // Allow parameter with lenght up to 99 characters
WebGetArg(webarg, arg, sizeof(arg));
char cmnd[120];
snprintf_P(cmnd, sizeof(cmnd), PSTR(";%s %s"), command, (!strlen(arg)) ? dflt : (StrCaseStr_P(command, PSTR("Password")) && (strlen(arg) < 5)) ? "" : arg);
return String(cmnd);
}
void WifiSaveSettings(void) { void WifiSaveSettings(void) {
String cmnd = F(D_CMND_BACKLOG "0 "); String cmnd = F(D_CMND_BACKLOG "0 ");
cmnd += AddWebCommand(PSTR(D_CMND_HOSTNAME), PSTR("h"), PSTR("1")); cmnd += AddWebCommand(PSTR(D_CMND_HOSTNAME), PSTR("h"), PSTR("1"));