return number;
}
static int get_options(void) {
- const char *pos = getenv("SOCKET2UNIX_OPTIONS");
- if (!pos) {
+ const char *start = getenv("SOCKET2UNIX_OPTIONS");
+ if (!start) {
return OPTION_PARSED;
}
int options = OPTION_PARSED;
- while (*pos != '\0') {
+ const char *end = start + strlen(start);
+ const char *pos, *curend;
+
+ for (pos = start; pos < end; pos = curend + 1) {
size_t length;
- const char *end = strchr(pos, ',');
- if (end == NULL) {
- length = strlen(pos);
- } else {
- length = (size_t)(end - pos);
+ curend = strchr(pos, ',');
+ if (curend == NULL) {
+ curend = end;
}
+ length = (size_t)(curend - pos);
if (!strncmp("client_only", pos, length)) {
options |= OPTION_CLIENT_ONLY;
ERROR("unknown option '%s' in SOCKET2UNIX_OPTIONS\n",
option);
}
-
- if (end == NULL) {
- break;
- }
- pos = end + 1;
}
if ((options & OPTION_CLIENT_ONLY) && (options & OPTION_SERVER_ONLY)) {