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