ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/fptools.h
Revision: 1.10
Committed: Fri Feb 14 08:02:26 2020 UTC (4 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-1_62
Changes since 1.9: +16 -0 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 /*
2 * fptools.c, some helper functions for getcgi.c and uu(en|de)view
3 *
4 * Distributed under the terms of the GNU General Public License.
5 * Use and be happy.
6 */
7
8 /*
9 * Some handy, nonstandard functions. Note that the original may
10 * be both faster and better. ``better'', if your compiler allows
11 * cleaner use of such functions by proper use of ``const''.
12 *
13 * $Id$
14 */
15
16 #ifndef FPTOOLS_H__
17 #define FPTOOLS_H__
18
19 #include <string.h>
20
21 typedef signed char schar;
22 typedef unsigned char uchar;
23
24 #ifndef TOOLEXPORT
25 #define TOOLEXPORT
26 #endif
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /* relicensed from libecb with permission */
33 #if 1
34
35 #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
36
37 #if ECB_GCC_VERSION(3,1)
38 #define ecb_expect(expr,value) __builtin_expect ((expr),(value))
39 #else
40 #define ecb_expect(expr,value) (expr)
41 #endif
42
43 #define ecb_expect_false(expr) ecb_expect (!!(expr), 0)
44 #define ecb_expect_true(expr) ecb_expect (!!(expr), 1)
45
46 #endif
47
48 #define _FP_free FP_free
49 #define _FP_strdup FP_strdup
50 #define _FP_strncpy FP_strncpy
51 #define _FP_memdup FP_memdup
52 #define _FP_stricmp FP_stricmp
53 #define _FP_strnicmp FP_strnicmp
54 #define _FP_strrstr FP_strrstr
55 #define _FP_stoupper FP_stoupper
56 #define _FP_stolower FP_stolower
57 #define _FP_strmatch FP_strmatch
58 #define _FP_strstr FP_strstr
59 #define _FP_stristr FP_stristr
60 #define _FP_strirstr FP_strirstr
61 #define _FP_strrchr FP_strrchr
62 #define _FP_fgets FP_fgets
63 #define _FP_strpbrk FP_strpbrk
64 #define _FP_strtok FP_strtok
65 #define _FP_cutdir FP_cutdir
66 #define _FP_strerror FP_strerror
67 #define _FP_tempnam FP_tempnam
68 #define _FP_fgetc FP_fgetc
69
70 #if HAVE_FGETC_UNLOCKED
71 # define FP_fgetc(s) fgetc_unlocked (s)
72 #else
73 # define FP_fgetc(s) fgetc (s)
74 #endif
75
76 #define FP_strstr(a,b) strstr (a, b)
77
78 void TOOLEXPORT _FP_free (void *);
79 char * TOOLEXPORT _FP_strdup (char *);
80 char * TOOLEXPORT _FP_strncpy (char *, char *, int);
81 void * TOOLEXPORT _FP_memdup (void *, int);
82 int TOOLEXPORT _FP_stricmp (const char *, const char *);
83 int TOOLEXPORT _FP_strnicmp (const char *, const char *, int);
84 char * TOOLEXPORT _FP_strrstr (char *, char *);
85 char * TOOLEXPORT _FP_stoupper (char *);
86 char * TOOLEXPORT _FP_stolower (char *);
87 int TOOLEXPORT _FP_strmatch (char *, char *);
88 char * TOOLEXPORT _FP_stristr (char *, char *);
89 char * TOOLEXPORT _FP_strirstr (char *, char *);
90 char * TOOLEXPORT _FP_strrchr (char *, int);
91 char * TOOLEXPORT _FP_fgets (char *, int, FILE *);
92 char * TOOLEXPORT _FP_strpbrk (char *, char *);
93 char * TOOLEXPORT _FP_strtok (char *, char *);
94 char * TOOLEXPORT _FP_cutdir (char *);
95 char * TOOLEXPORT _FP_strerror (int);
96 #ifndef HAVE_MKSTEMP
97 char * TOOLEXPORT _FP_tempnam (char *, char *);
98 #endif /* HAVE_MKSTEMP */
99
100 #if 0 /* API differs too much between systems to make those replacements */
101 #if HAVE_STRCASECMP
102 # define FP_stricmp(a,b) strcasecmp (a, b)
103 #endif
104
105 #if HAVE_STRNCASECMP
106 # define FP_strnicmp(a,b,l) strncasecmp (a, b, l)
107 #endif
108
109 #if HAVE_STRCASESTR
110 # define FP_stristr(a,b) strcasestr (a, b)
111 #endif
112 #endif
113
114 #ifdef __cplusplus
115 }
116 #endif
117 #endif
118