| 79 | */ |
| 80 | |
| 81 | int /* O - 1 if all variables present, 0 otherwise */ |
| 82 | cgiCheckVariables(const char *names) /* I - Variables to look for */ |
| 83 | { |
| 84 | char name[255], /* Current variable name */ |
| 85 | *s; /* Pointer in string */ |
| 86 | const char *val; /* Value of variable */ |
| 87 | int element; /* Array element number */ |
| 88 | |
| 89 | |
| 90 | if (names == NULL) |
| 91 | return (1); |
| 92 | |
| 93 | while (*names != '\0') |
| 94 | { |
| 95 | while (*names == ' ' || *names == ',') |
| 96 | names ++; |
| 97 | |
| 98 | for (s = name; *names != '\0' && *names != ' ' && *names != ','; names ++) |
| 99 | { |
| 100 | if (s < (name + sizeof(name) - 1)) |
| 101 | *s++ = *names; |
| 102 | } |
| 103 | |
| 104 | *s = 0; |
| 105 | if (name[0] == '\0') |
| 106 | break; |
| 107 | |
| 108 | if ((s = strrchr(name, '-')) != NULL) |
| 109 | { |
| 110 | *s = '\0'; |
| 111 | element = atoi(s + 1) - 1; |
| 112 | val = cgiGetArray(name, element); |
| 113 | } |
| 114 | else |
| 115 | val = cgiGetVariable(name); |
| 116 | |
| 117 | if (val == NULL) |
| 118 | return (0); |
| 119 | |
| 120 | if (*val == '\0') |
| 121 | { |
| 122 | free((void *)val); |
| 123 | return (0); /* Can't be blank, either! */ |
| 124 | } |
| 125 | |
| 126 | free((void *)val); |
| 127 | } |
| 128 | |
| 129 | return (1); |
| 130 | } |
| 131 | |
| 132 | |
| 133 | /* |
nothing calls this directly
no test coverage detected