1ce3adf43SDag-Erling Smørgrav /*
2ce3adf43SDag-Erling Smørgrav * Copyright (c) 2005 Darren Tucker
3ce3adf43SDag-Erling Smørgrav *
4ce3adf43SDag-Erling Smørgrav * Permission to use, copy, modify, and distribute this software for any
5ce3adf43SDag-Erling Smørgrav * purpose with or without fee is hereby granted, provided that the above
6ce3adf43SDag-Erling Smørgrav * copyright notice and this permission notice appear in all copies.
7ce3adf43SDag-Erling Smørgrav *
8ce3adf43SDag-Erling Smørgrav * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9ce3adf43SDag-Erling Smørgrav * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10ce3adf43SDag-Erling Smørgrav * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11ce3adf43SDag-Erling Smørgrav * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12ce3adf43SDag-Erling Smørgrav * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13ce3adf43SDag-Erling Smørgrav * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14ce3adf43SDag-Erling Smørgrav * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15ce3adf43SDag-Erling Smørgrav */
16ce3adf43SDag-Erling Smørgrav
17*19261079SEd Maste #include "includes.h"
18*19261079SEd Maste
19ce3adf43SDag-Erling Smørgrav #include <stdlib.h>
20ce3adf43SDag-Erling Smørgrav #include <string.h>
21ce3adf43SDag-Erling Smørgrav
22ce3adf43SDag-Erling Smørgrav static int fail = 0;
23ce3adf43SDag-Erling Smørgrav
24ce3adf43SDag-Erling Smørgrav void
test(const char * a)25ce3adf43SDag-Erling Smørgrav test(const char *a)
26ce3adf43SDag-Erling Smørgrav {
27ce3adf43SDag-Erling Smørgrav char *b;
28ce3adf43SDag-Erling Smørgrav
29ce3adf43SDag-Erling Smørgrav b = strdup(a);
30ce3adf43SDag-Erling Smørgrav if (b == 0) {
31ce3adf43SDag-Erling Smørgrav fail = 1;
32ce3adf43SDag-Erling Smørgrav return;
33ce3adf43SDag-Erling Smørgrav }
34ce3adf43SDag-Erling Smørgrav if (strcmp(a, b) != 0)
35ce3adf43SDag-Erling Smørgrav fail = 1;
36ce3adf43SDag-Erling Smørgrav free(b);
37ce3adf43SDag-Erling Smørgrav }
38ce3adf43SDag-Erling Smørgrav
39ce3adf43SDag-Erling Smørgrav int
main(void)40ce3adf43SDag-Erling Smørgrav main(void)
41ce3adf43SDag-Erling Smørgrav {
42ce3adf43SDag-Erling Smørgrav test("");
43ce3adf43SDag-Erling Smørgrav test("a");
44ce3adf43SDag-Erling Smørgrav test("\0");
45ce3adf43SDag-Erling Smørgrav test("abcdefghijklmnopqrstuvwxyz");
46ce3adf43SDag-Erling Smørgrav return fail;
47ce3adf43SDag-Erling Smørgrav }
48