OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [generic/] [tixCompat.c] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tixCompat.c --
3
 *
4
 *      Some compatibility functions for Tix.
5
 *
6
 * Copyright (c) 1996, Expert Interface Technologies
7
 *
8
 * See the file "license.terms" for information on usage and redistribution
9
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
 *
11
 */
12
 
13
#include <tixPort.h>
14
#include <tixInt.h>
15
 
16
/*
17
 * strdup is not a POSIX call and is not supported on many platforms.
18
 */
19
 
20
char * tixStrDup(s)
21
    CONST char * s;
22
{
23
    size_t len = strlen(s)+1;
24
    char * new_string;
25
 
26
    new_string = (char*)ckalloc(len);
27
    strcpy(new_string, s);
28
 
29
    return new_string;
30
}
31
 
32
#ifdef NO_STRCASECMP
33
 
34
int tixStrCaseCmp _ANSI_ARGS_((CONST char * a, CONST char * b));
35
 
36
int tixStrCaseCmp(a, b)
37
    CONST char * a;
38
    CONST char * b;
39
{
40
    while (1) {
41
        if (*a== 0 && *b==0) {
42
            return 0;
43
        }
44
        if (*a==0) {
45
            return (1);
46
        }
47
        if (*b==0) {
48
            return (-1);
49
        }
50
        if (tolower(*a)>tolower(*b)) {
51
            return (-1);
52
        }
53
        if (tolower(*b)>tolower(*a)) {
54
            return (1);
55
        }
56
        a++; b++;
57
    }
58
}
59
 
60
#endif /* NO_STRCASECMP */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.