119370Spst/* 219370Spst * Copyright (c) 2005 Darren Tucker 3130803Smarcel * 4130803Smarcel * Permission to use, copy, modify, and distribute this software for any 5130803Smarcel * purpose with or without fee is hereby granted, provided that the above 6130803Smarcel * copyright notice and this permission notice appear in all copies. 798944Sobrien * 819370Spst * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 998944Sobrien * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1098944Sobrien * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1198944Sobrien * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1298944Sobrien * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1319370Spst * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1498944Sobrien * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1598944Sobrien */ 1698944Sobrien 1798944Sobrien#include <stdlib.h> 1819370Spst#include <string.h> 1998944Sobrien 2098944Sobrienstatic int fail = 0; 2198944Sobrien 2298944Sobrienvoid 2319370Spsttest(const char *a) 2419370Spst{ 2519370Spst char *b; 2619370Spst 2719370Spst b = strdup(a); 2819370Spst if (b == 0) { 2919370Spst fail = 1; 3019370Spst return; 3119370Spst } 32130803Smarcel if (strcmp(a, b) != 0) 3319370Spst fail = 1; 3419370Spst free(b); 35130803Smarcel} 36130803Smarcel 37130803Smarcelint 3819370Spstmain(void) 3919370Spst{ 40130803Smarcel test(""); 4119370Spst test("a"); 4219370Spst test("\0"); 4319370Spst test("abcdefghijklmnopqrstuvwxyz"); 4419370Spst return fail; 4519370Spst} 4619370Spst