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

Function cgi_initialize_string

cgi-bin/var.c:1133–1253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1131 */
1132
1133static int /* O - 1 if form data was processed */
1134cgi_initialize_string(const char *data) /* I - Form data string */
1135{
1136 int done; /* True if we're done reading a form variable */
1137 char *s, /* Pointer to current form string */
1138 ch, /* Temporary character */
1139 name[255], /* Name of form variable */
1140 value[65536], /* Variable value */
1141 *temp; /* Temporary pointer */
1142
1143
1144 /*
1145 * Check input...
1146 */
1147
1148 if (data == NULL)
1149 return (0);
1150
1151 /*
1152 * Loop until we've read all the form data...
1153 */
1154
1155 while (*data != '\0')
1156 {
1157 /*
1158 * Get the variable name...
1159 */
1160
1161 for (s = name; *data != '\0'; data ++)
1162 if (*data == '=')
1163 break;
1164 else if (*data >= ' ' && s < (name + sizeof(name) - 1))
1165 *s++ = *data;
1166
1167 *s = '\0';
1168 if (*data == '=')
1169 data ++;
1170 else
1171 return (0);
1172
1173 /*
1174 * Read the variable value...
1175 */
1176
1177 for (s = value, done = 0; !done && *data != '\0'; data ++)
1178 switch (*data)
1179 {
1180 case '&' : /* End of data... */
1181 done = 1;
1182 break;
1183
1184 case '+' : /* Escaped space character */
1185 if (s < (value + sizeof(value) - 1))
1186 *s++ = ' ';
1187 break;
1188
1189 case '%' : /* Escaped control character */
1190 /*

Callers 2

cgi_initialize_getFunction · 0.85
cgi_initialize_postFunction · 0.85

Calls 4

cgiSetArrayFunction · 0.85
cgiGetVariableFunction · 0.85
cgiGetSizeFunction · 0.85
cgiSetVariableFunction · 0.85

Tested by

no test coverage detected