| 357 | } |
| 358 | |
| 359 | static size_t add_check_box(const char *name, bool disabled, const char *label, const char *sufix, bool checked, char *buffer) |
| 360 | { |
| 361 | if(!buffer || !label) return 0; |
| 362 | |
| 363 | char html[MAX_LINE_LEN]; |
| 364 | const char *pos = strstr(label, AUTOBOOT_PATH), *clabel = label; |
| 365 | if(pos) |
| 366 | { |
| 367 | char *autob = html + 100; clabel = autob; |
| 368 | int n = (pos - label); strcpy(autob, label); // prefix |
| 369 | const char *on_startup = pos + strlen(AUTOBOOT_PATH); // sufix |
| 370 | sprintf(autob + n, HTML_INPUT("autop", "%s", "255", "40") "%s", webman_config->autoboot_path, on_startup); |
| 371 | } |
| 372 | sprintf(html, "<label><input type=\"checkbox\" name=\"%s\" value=\"1\" %s%s/> %s</label>%s", |
| 373 | name, |
| 374 | disabled ? HTML_DISABLED_CHECKBOX : "", |
| 375 | checked ? ITEM_CHECKED : "", |
| 376 | clabel, (!sufix) ? "<br>" : sufix); |
| 377 | return concat(buffer, html); |
| 378 | } |
| 379 | |
| 380 | static size_t add_checkbox(const char *name, const char *label, const char *sufix, bool checked, char *buffer) |
| 381 | { |