Debian Codegraph @

pTk/mTk/tixGeneric/tixCompat.c

raw symbols SCIP
1
2 /* $Id: tixCompat.c,v 1.1.1.1 2000/05/17 11:08:37 idiscovery Exp $ */
3
4 /*
5 * tixCompat.c --
6 *
7 * Some compatibility functions for Tix.
8 *
9 * Copyright (c) 1996, Expert Interface Technologies
10 *
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 *
14 */
15
16 #include "tixPort.h"
17 #include "tixInt.h"
18
19
20 /*
21 * strdup is not a POSIX call and is not supported on many platforms.
22 * Also Tix code assumes it can ckfree() what has been strdup()'ed
23 * which may not be valid using system's strdup() and non-system malloc/free
24 * equivalents fot ckalloc()/ckfree()
25 */
26
27 char * tixStrDup(s)
28 CONST char * s;
29 {
30 size_t len = strlen(s)+1;
31 char * new_string;
32
33 new_string = (char*)ckalloc(len);
34 if (new_string)
35 strcpy(new_string, s);
36
37 return new_string;
38 }
39
40
41
42 #ifdef NO_STRCASECMP
43
44 int tixStrCaseCmp _ANSI_ARGS_((CONST char * a, CONST char * b));
45
46 int tixStrCaseCmp(a, b)
47 CONST char * a;
48 CONST char * b;
49 {
50 while (1) {
51 if (*a== 0 && *b==0) {
52 return 0;
53 }
54 if (*a==0) {
55 return (1);
56 }
57 if (*b==0) {
58 return (-1);
59 }
60 if (tolower(*a)>tolower(*b)) {
61 return (-1);
62 }
63 if (tolower(*b)>tolower(*a)) {
64 return (1);
65 }
66 a++; b++;
67 }
68 }
69
70 #endif /* NO_STRCASECMP */