Debian Codegraph @

src/include/missing_strings.h

raw
1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2014
3 // David Freese, W1HKJ
4 //
5 // This file is part of flmsg
6 //
7 // flrig is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // flrig is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 // ----------------------------------------------------------------------------
20
21 /*
22 * "$Id: flstring.h 4660 2005-11-27 14:45:48Z mike $"
23 *
24 * Common std::string header file for the Fast Light Tool Kit (FLTK).
25 * versions < 1.3.x
26 *
27 * Copyright 1998-2005 by Bill Spitzak and others.
28 */
29
30 #ifndef flstring_h
31 # define flstring_h
32
33 #include <config.h>
34
35 // versions of FLTK < 1.3.2 do not contain fl_string
36 #if (FLMSG_FLTK_API_MAJOR == 1 && FLMSG_FLTK_API_MINOR < 3 ) || \
37 (FLMSG_FLTK_API_MAJOR == 1 && FLMSG_FLTK_API_MINOR == 3 && FLMSG_FLTK_API_PATCH < 1)
38
39 # include <FL/Fl_Export.H>
40 # include <config.h>
41 # include <stdio.h>
42 # include <stdarg.h>
43 # include <string.h>
44
45 # ifdef HAVE_STRINGS_H
46 # include <strings.h>
47 # endif /* HAVE_STRINGS_H */
48
49 # include <ctype.h>
50
51 /*
52 * Apparently Unixware defines "index" to strchr (!) rather than
53 * providing a proper entry point or not providing the (obsolete)
54 * BSD function. Make sure index is not defined...
55 */
56
57 # ifdef index
58 # undef index
59 # endif /* index */
60
61 # if defined(WIN32) && !defined(__CYGWIN__)
62 # define strcasecmp(s,t) _stricmp((s), (t))
63 # define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
64 // Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
65 // on Windows, which is supposed to be POSIX compliant... Some of these functions
66 // are also defined in ISO C99...
67 # define strdup _strdup
68 # define unlink _unlink
69 # elif defined(__EMX__)
70 # define strcasecmp(s,t) stricmp((s), (t))
71 # define strncasecmp(s,t,n) strnicmp((s), (t), (n))
72 # endif /* WIN32 */
73
74 # ifdef __cplusplus
75 extern "C" {
76 # endif /* __cplusplus */
77
78 /*
79 * MetroWerks' CodeWarrior put thes "non-standard" functions in
80 * <extras.h> which unfortunatly does not play well otherwise
81 * when included - to be resolved...
82 */
83
84 # if defined(__APPLE__) && defined(__MWERKS__) && defined(_MSL_USING_MW_C_HEADERS)
85 int strcasecmp(const char*,const char*);
86 int strncasecmp(const char*,const char*,int);
87 char *strdup(const char*);
88 # endif
89
90 FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
91 # if !HAVE_SNPRINTF
92 # define snprintf fl_snprintf
93 # endif /* !HAVE_SNPRINTF */
94
95 FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
96 # if !HAVE_VSNPRINTF
97 # define vsnprintf fl_vsnprintf
98 # endif /* !HAVE_VSNPRINTF */
99
100 /*
101 * strlcpy() and strlcat() are some really useful BSD std::string functions
102 * that work the way strncpy() and strncat() *should* have worked.
103 */
104
105 FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
106 # if !HAVE_STRLCAT
107 # define strlcat fl_strlcat
108 # endif /* !HAVE_STRLCAT */
109
110 FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
111 # if !HAVE_STRLCPY
112 # define strlcpy fl_strlcpy
113 # endif /* !HAVE_STRLCPY */
114
115 # ifdef __cplusplus
116 }
117 # endif /* __cplusplus */
118
119 #endif /* < FLTK < 1.3.0 */
120
121 #endif /* !flstring_h */
122