… | |
… | |
8 | /* |
8 | /* |
9 | * Some handy, nonstandard functions. Note that the original may |
9 | * Some handy, nonstandard functions. Note that the original may |
10 | * be both faster and better. ``better'', if your compiler allows |
10 | * be both faster and better. ``better'', if your compiler allows |
11 | * cleaner use of such functions by proper use of ``const''. |
11 | * cleaner use of such functions by proper use of ``const''. |
12 | * |
12 | * |
13 | * $Id: fptools.h,v 1.11 2020/02/27 06:14:29 root Exp $ |
13 | * $Id: fptools.h,v 1.12 2020/12/11 20:09:23 root Exp $ |
14 | */ |
14 | */ |
15 | |
15 | |
16 | #ifndef FPTOOLS_H__ |
16 | #ifndef FPTOOLS_H__ |
17 | #define FPTOOLS_H__ |
17 | #define FPTOOLS_H__ |
18 | |
18 | |
… | |
… | |
29 | |
29 | |
30 | #ifdef __cplusplus |
30 | #ifdef __cplusplus |
31 | extern "C" { |
31 | extern "C" { |
32 | #endif |
32 | #endif |
33 | |
33 | |
34 | #define _FP_free FP_free |
34 | #if HAVE_GETC_UNLOCKED |
35 | #define _FP_strdup FP_strdup |
35 | # define FP_getc(s) getc_unlocked (s) |
36 | #define _FP_strncpy FP_strncpy |
36 | #else |
37 | #define _FP_memdup FP_memdup |
37 | # define FP_getc(s) getc (s) |
38 | #define _FP_stricmp FP_stricmp |
38 | #endif |
39 | #define _FP_strnicmp FP_strnicmp |
|
|
40 | #define _FP_strrstr FP_strrstr |
|
|
41 | #define _FP_stoupper FP_stoupper |
|
|
42 | #define _FP_stolower FP_stolower |
|
|
43 | #define _FP_strmatch FP_strmatch |
|
|
44 | #define _FP_strstr FP_strstr |
|
|
45 | #define _FP_stristr FP_stristr |
|
|
46 | #define _FP_strirstr FP_strirstr |
|
|
47 | #define _FP_strrchr FP_strrchr |
|
|
48 | #define _FP_fgets FP_fgets |
|
|
49 | #define _FP_strpbrk FP_strpbrk |
|
|
50 | #define _FP_strtok FP_strtok |
|
|
51 | #define _FP_cutdir FP_cutdir |
|
|
52 | #define _FP_strerror FP_strerror |
|
|
53 | #define _FP_tempnam FP_tempnam |
|
|
54 | #define _FP_fgetc FP_fgetc |
|
|
55 | |
39 | |
56 | #if HAVE_FGETC_UNLOCKED |
40 | #if HAVE_FEOF_UNLOCKED |
57 | # define FP_fgetc(s) fgetc_unlocked (s) |
41 | # define FP_feof(s) feof_unlocked (s) |
58 | #else |
42 | #else |
59 | # define FP_fgetc(s) fgetc (s) |
43 | # define FP_feof(s) feof (s) |
|
|
44 | #endif |
|
|
45 | |
|
|
46 | #if HAVE_FERROR_UNLOCKED |
|
|
47 | # define FP_ferror(s) ferror_unlocked (s) |
|
|
48 | #else |
|
|
49 | # define FP_ferror(s) ferror (s) |
60 | #endif |
50 | #endif |
61 | |
51 | |
62 | #define FP_strstr(a,b) strstr (a, b) |
52 | #define FP_strstr(a,b) strstr (a, b) |
63 | |
53 | |
64 | void TOOLEXPORT _FP_free (void *); |
54 | void TOOLEXPORT FP_free (void *); |
65 | char * TOOLEXPORT _FP_strdup (char *); |
55 | char * TOOLEXPORT FP_strdup (char *); |
66 | char * TOOLEXPORT _FP_strncpy (char *, char *, int); |
56 | char * TOOLEXPORT FP_strncpy (char *, char *, int); |
67 | void * TOOLEXPORT _FP_memdup (void *, int); |
57 | void * TOOLEXPORT FP_memdup (void *, int); |
68 | int TOOLEXPORT _FP_stricmp (const char *, const char *); |
58 | int TOOLEXPORT FP_stricmp (const char *, const char *); |
69 | int TOOLEXPORT _FP_strnicmp (const char *, const char *, int); |
59 | int TOOLEXPORT FP_strnicmp (const char *, const char *, int); |
70 | char * TOOLEXPORT _FP_strrstr (char *, char *); |
60 | char * TOOLEXPORT FP_strrstr (char *, char *); |
71 | char * TOOLEXPORT _FP_stoupper (char *); |
61 | char * TOOLEXPORT FP_stoupper (char *); |
72 | char * TOOLEXPORT _FP_stolower (char *); |
62 | char * TOOLEXPORT FP_stolower (char *); |
73 | int TOOLEXPORT _FP_strmatch (char *, char *); |
63 | int TOOLEXPORT FP_strmatch (char *, char *); |
74 | char * TOOLEXPORT _FP_stristr (char *, char *); |
64 | char * TOOLEXPORT FP_stristr (char *, char *); |
75 | char * TOOLEXPORT _FP_strirstr (char *, char *); |
65 | char * TOOLEXPORT FP_strirstr (char *, char *); |
76 | char * TOOLEXPORT _FP_strrchr (char *, int); |
66 | char * TOOLEXPORT FP_strrchr (char *, int); |
77 | char * TOOLEXPORT _FP_fgets (char *, int, FILE *); |
67 | char * TOOLEXPORT FP_fgets (char *, int, FILE *); |
78 | char * TOOLEXPORT _FP_strpbrk (char *, char *); |
68 | char * TOOLEXPORT FP_strpbrk (char *, char *); |
79 | char * TOOLEXPORT _FP_strtok (char *, char *); |
69 | char * TOOLEXPORT FP_strtok (char *, char *); |
80 | char * TOOLEXPORT _FP_cutdir (char *); |
70 | char * TOOLEXPORT FP_cutdir (char *); |
81 | char * TOOLEXPORT _FP_strerror (int); |
71 | char * TOOLEXPORT FP_strerror (int); |
82 | #ifndef HAVE_MKSTEMP |
72 | #ifndef HAVE_MKSTEMP |
83 | char * TOOLEXPORT _FP_tempnam (char *, char *); |
73 | char * TOOLEXPORT FP_tempnam (char *, char *); |
84 | #endif /* HAVE_MKSTEMP */ |
74 | #endif /* HAVE_MKSTEMP */ |
85 | |
75 | |
86 | #if 0 /* API differs too much between systems to make those replacements */ |
76 | #if 0 /* API differs too much between systems to make those replacements */ |
87 | #if HAVE_STRCASECMP |
77 | #if HAVE_STRCASECMP |
88 | # define FP_stricmp(a,b) strcasecmp (a, b) |
78 | # define FP_stricmp(a,b) strcasecmp (a, b) |