blob: 87f35af32d834eeaedb8435e58459fa5eafcc3de (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 | /*
** Copyright 2007 Double Precision, Inc.
** See COPYING for distribution information.
*/
/*
*/
#include	"cgi.h"
#include	<stdio.h>
#include	<string.h>
#include	<stdlib.h>
#include	<ctype.h>
char *cgi_checkbox(const char *name,
		   const char *value,
		   const char *flags)
{
	char *buf;
	if (!value)
		value="";
	buf=malloc(strlen(name)+strlen(flags)+200);
	if (!buf)
		return NULL;
	strcpy(buf, "<input type='checkbox' name='");
	strcat(buf, name);
	strcat(buf, "' value='");
	strcat(buf, value);
	strcat(buf, "'");
	if (strchr(flags, '*'))
		strcat(buf, " checked='checked'");
	if (strchr(flags, 'd'))
		strcat(buf, " disabled='disabled'");
	strcat(buf, " />");
	return buf;
}
 |