ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/fptools.h
Revision: 1.15
Committed: Sat Dec 12 03:55:00 2020 UTC (3 years, 5 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.14: +7 -4 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 /*
2     * fptools.c, some helper functions for getcgi.c and uu(en|de)view
3     *
4 root 1.2 * Distributed under the terms of the GNU General Public License.
5     * Use and be happy.
6 root 1.1 */
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 root 1.7 * $Id$
14 root 1.1 */
15    
16     #ifndef FPTOOLS_H__
17     #define FPTOOLS_H__
18    
19 root 1.7 #include <string.h>
20    
21 root 1.1 typedef signed char schar;
22     typedef unsigned char uchar;
23    
24 root 1.11 #include "ecb.h"
25    
26 root 1.1 #ifndef TOOLEXPORT
27     #define TOOLEXPORT
28     #endif
29    
30     #ifdef __cplusplus
31     extern "C" {
32     #endif
33 root 1.4
34 root 1.12 #if HAVE_GETC_UNLOCKED
35     # define FP_getc(s) getc_unlocked (s)
36     #else
37     # define FP_getc(s) getc (s)
38     #endif
39    
40     #if HAVE_FEOF_UNLOCKED
41     # define FP_feof(s) feof_unlocked (s)
42     #else
43     # define FP_feof(s) feof (s)
44     #endif
45 root 1.7
46 root 1.12 #if HAVE_FERROR_UNLOCKED
47     # define FP_ferror(s) ferror_unlocked (s)
48 root 1.7 #else
49 root 1.12 # define FP_ferror(s) ferror (s)
50 root 1.7 #endif
51    
52 root 1.15 #if HAVE_FLOCKFILE
53     # define FP_flockfile(s) flockfile (s)
54     #else
55     # define FP_flockfile(s) ((void *)0)
56     #endif
57    
58 root 1.7 #define FP_strstr(a,b) strstr (a, b)
59 root 1.15 #define FP_strerror(a) strerror (a)
60 root 1.5
61 root 1.12 void TOOLEXPORT FP_free (void *);
62     char * TOOLEXPORT FP_strdup (char *);
63     char * TOOLEXPORT FP_strncpy (char *, char *, int);
64 root 1.13 void * TOOLEXPORT FP_memdup (const void *, int);
65 root 1.12 int TOOLEXPORT FP_stricmp (const char *, const char *);
66     int TOOLEXPORT FP_strnicmp (const char *, const char *, int);
67 root 1.14 char * TOOLEXPORT FP_strrstr (const char *, const char *);
68 root 1.12 char * TOOLEXPORT FP_stoupper (char *);
69     char * TOOLEXPORT FP_stolower (char *);
70     int TOOLEXPORT FP_strmatch (char *, char *);
71     char * TOOLEXPORT FP_stristr (char *, char *);
72     char * TOOLEXPORT FP_strirstr (char *, char *);
73 root 1.13 char * TOOLEXPORT FP_strrchr (const char *, int);
74 root 1.12 char * TOOLEXPORT FP_fgets (char *, int, FILE *);
75     char * TOOLEXPORT FP_strpbrk (char *, char *);
76     char * TOOLEXPORT FP_strtok (char *, char *);
77     char * TOOLEXPORT FP_cutdir (char *);
78 root 1.1
79 root 1.13 /* like stgricmp, but only works when one of the strings is printable ascii */
80     /* not containing any of these characters: @`[\]^:_{|}~ */
81     int TOOLEXPORT FP_strnicmp_fast (const char *, const char *, int);
82    
83 root 1.8 #if 0 /* API differs too much between systems to make those replacements */
84 root 1.7 #if HAVE_STRCASECMP
85     # define FP_stricmp(a,b) strcasecmp (a, b)
86     #endif
87    
88     #if HAVE_STRNCASECMP
89     # define FP_strnicmp(a,b,l) strncasecmp (a, b, l)
90     #endif
91    
92     #if HAVE_STRCASESTR
93     # define FP_stristr(a,b) strcasestr (a, b)
94     #endif
95 root 1.8 #endif
96 root 1.7
97 root 1.1 #ifdef __cplusplus
98     }
99     #endif
100     #endif
101 root 1.5