MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cgiGetCheckbox

Function cgiGetCheckbox

cgi-bin/var.c:188–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 */
187
188int /* O - 1 if checked, 0 otherwise */
189cgiGetCheckbox(const char *name) /* I - Name of form field */
190{
191 _cgi_var_t *var = cgi_find_variable(name);
192 /* Found variable */
193 const char *value = var ? var->values[var->nvalues - 1] : NULL;
194 int ret; /* Return value */
195
196
197 ret = value && !_cups_strcasecmp(value, "checked");
198
199 if (!ret && value)
200 {
201 /*
202 * Delete the invalid checkbox value...
203 */
204
205 int i = var - form_vars, j;
206
207 form_count --;
208
209 for (j = 0; j < var->nvalues; j ++)
210 free(var->values[j]);
211 free(var->name);
212 free(var->values);
213
214 if (i < form_count)
215 memmove(var, var + 1, (size_t)(form_count - i) * sizeof(_cgi_var_t));
216 }
217
218 return (ret);
219}
220
221
222/*

Callers 2

do_am_printerFunction · 0.85
do_config_serverFunction · 0.85

Calls 2

cgi_find_variableFunction · 0.85
_cups_strcasecmpFunction · 0.85

Tested by

no test coverage detected