2 * Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>.
3 * Distributed under the terms of the MIT License.
15 char* const keys
[] = {
16 "mode", "be-lenient", NULL
19 char* option
= strdup("mode=readwrite,unknown,be-lenient");
21 int result
= getsubopt(&option
, keys
, &value
);
23 fprintf(stderr
, "failed 1: result=%d, expected %d\n", result
, 0);
24 if (value
== NULL
|| strcmp(value
, "readwrite") != 0)
25 fprintf(stderr
, "failed 2: value=%s, expected 'readwrite'\n", value
);
26 result
= getsubopt(&option
, keys
, &value
);
28 fprintf(stderr
, "failed 3: result=%d, expected %d\n", result
, -1);
30 fprintf(stderr
, "failed 4: value=%p, expected NULL\n", value
);
31 result
= getsubopt(&option
, keys
, &value
);
33 fprintf(stderr
, "failed 5: result=%d, expected %d\n", result
, 1);
35 fprintf(stderr
, "failed 6: value=%p, expected NULL\n", value
);