MCPcopy Create free account
hub / github.com/aldostools/webMAN-MOD / add_check_box

Function add_check_box

include/init/html.h:359–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359static 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
380static size_t add_checkbox(const char *name, const char *label, const char *sufix, bool checked, char *buffer)
381{

Callers 2

add_checkboxFunction · 0.85
add_sc_checkboxFunction · 0.85

Calls 5

concatFunction · 0.85
strstrFunction · 0.50
strcpyFunction · 0.50
strlenFunction · 0.50
sprintfFunction · 0.50

Tested by

no test coverage detected