FLTK 1.4.0
Loading...
Searching...
No Matches
flstring.h
1/*
2 * Common string header file for the Fast Light Tool Kit (FLTK).
3 * Internal use only (see "important note" below).
4 *
5 * Copyright 1998-2020 by Bill Spitzak and others.
6 *
7 * This library is free software. Distribution and use rights are outlined in
8 * the file "COPYING" which should have been included with this file. If this
9 * file is missing or damaged, see the license at:
10 *
11 * https://www.fltk.org/COPYING.php
12 *
13 * Please see the following page on how to report bugs and issues:
14 *
15 * https://www.fltk.org/bugs.php
16 */
17
18 /*
19 * Important note: this header file includes '<config.h>' !
20 *
21 * This header MUST NOT be included in public headers (i.e. in 'FL/') and
22 * SHOULD NOT be included in test and demo programs (i.e. in 'test/' or
23 * 'examples/') because it includes '<config.h>'.
24 */
25
26#ifndef flstring_h
27# define flstring_h
28
29# include <FL/Fl_Export.H>
30# include <config.h>
31# include <stdio.h>
32# include <stdarg.h>
33# include <string.h>
34# ifdef HAVE_STRINGS_H
35# include <strings.h>
36# endif /* HAVE_STRINGS_H */
37# include <ctype.h>
38
39/*
40 * Apparently Unixware defines "index" to strchr (!) rather than
41 * providing a proper entry point or not providing the (obsolete)
42 * BSD function. Make sure index is not defined...
43 */
44
45# ifdef index
46# undef index
47# endif /* index */
48
49/*
50 * Visual C++ 2005 incorrectly displays a warning about the use of
51 * POSIX APIs on Windows, which is supposed to be POSIX compliant...
52 * Some of these functions are also defined in ISO C99...
53 */
54
55# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
56# define strcasecmp(s,t) _stricmp((s), (t))
57# define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
58# endif /* _WIN32 && ... */
59
60# ifdef __cplusplus
61extern "C" {
62# endif /* __cplusplus */
63
64FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
65# ifndef HAVE_SNPRINTF
66# define snprintf fl_snprintf
67# endif /* !HAVE_SNPRINTF */
68
69FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
70# ifndef HAVE_VSNPRINTF
71# define vsnprintf fl_vsnprintf
72# endif /* !HAVE_VSNPRINTF */
73
74/*
75 * strlcpy() and strlcat() are some really useful BSD string functions
76 * that work the way strncpy() and strncat() *should* have worked.
77 */
78
79FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
80# ifndef HAVE_STRLCAT
81# define strlcat fl_strlcat
82# endif /* !HAVE_STRLCAT */
83
84FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
85# ifndef HAVE_STRLCPY
86# define strlcpy fl_strlcpy
87# endif /* !HAVE_STRLCPY */
88
89/*
90 * Locale independent ASCII string compare function,
91 * does not introduce locale issues as with strcasecmp()
92 */
93FL_EXPORT extern int fl_ascii_strcasecmp(const char *s, const char *t);
94
95# ifdef __cplusplus
96}
97# endif /* __cplusplus */
98
99#endif /* !flstring_h */