• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

flstring.h

00001 /*
00002  * "$Id$"
00003  *
00004  * Common string header file for the Fast Light Tool Kit (FLTK).
00005  *
00006  * Copyright 1998-2016 by Bill Spitzak and others.
00007  *
00008  * This library is free software. Distribution and use rights are outlined in
00009  * the file "COPYING" which should have been included with this file.  If this
00010  * file is missing or damaged, see the license at:
00011  *
00012  *     http://www.fltk.org/COPYING.php
00013  *
00014  * Please report all bugs and problems on the following page:
00015  *
00016  *     http://www.fltk.org/str.php
00017  */
00018 
00019 #ifndef flstring_h
00020 #  define flstring_h
00021 
00022 #  include <FL/Fl_Export.H>
00023 #  include <config.h>
00024 #  include <stdio.h>
00025 #  include <stdarg.h>
00026 #  include <string.h>
00027 #  ifdef HAVE_STRINGS_H
00028 #    include <strings.h>
00029 #  endif /* HAVE_STRINGS_H */
00030 #  include <ctype.h>
00031 
00032 /*
00033  * Apparently Unixware defines "index" to strchr (!) rather than
00034  * providing a proper entry point or not providing the (obsolete)
00035  * BSD function.  Make sure index is not defined...
00036  */
00037 
00038 #  ifdef index
00039 #    undef index
00040 #  endif /* index */
00041 
00042 #  if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
00043 #    define strcasecmp(s,t)     _stricmp((s), (t))
00044 #    define strncasecmp(s,t,n)  _strnicmp((s), (t), (n))
00045 /* Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
00046  * on Windows, which is supposed to be POSIX compliant...  Some of these
00047  * functions are also defined in ISO C99...
00048  */
00049 #    ifndef __WATCOMC__
00050 #      define strdup _strdup
00051 #      define unlink _unlink
00052 #    endif /* !__WATCOMC__ */
00053 #  elif defined(__EMX__)
00054 #    define strcasecmp(s,t)     stricmp((s), (t))
00055 #    define strncasecmp(s,t,n)  strnicmp((s), (t), (n))
00056 #  endif /* WIN32 */
00057 
00058 #  ifdef __cplusplus
00059 extern "C" {
00060 #  endif /* __cplusplus */
00061 
00062 FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
00063 #  ifndef HAVE_SNPRINTF
00064 #    define snprintf fl_snprintf
00065 #  endif /* !HAVE_SNPRINTF */
00066 
00067 FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
00068 #  ifndef HAVE_VSNPRINTF
00069 #    define vsnprintf fl_vsnprintf
00070 #  endif /* !HAVE_VSNPRINTF */
00071 
00072 /*
00073  * strlcpy() and strlcat() are some really useful BSD string functions
00074  * that work the way strncpy() and strncat() *should* have worked.
00075  */
00076 
00077 FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
00078 #  ifndef HAVE_STRLCAT
00079 #    define strlcat fl_strlcat
00080 #  endif /* !HAVE_STRLCAT */
00081 
00082 FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
00083 #  ifndef HAVE_STRLCPY
00084 #    define strlcpy fl_strlcpy
00085 #  endif /* !HAVE_STRLCPY */
00086 
00087 /*
00088  * locale independent ascii compare, does not introduce locale 
00089  * pbs as w/  case cmp 
00090  */
00091 FL_EXPORT extern int fl_ascii_strcasecmp(const char *s, const char *t);
00092 
00093 #  ifdef __cplusplus
00094 }
00095 #  endif /* __cplusplus */
00096 
00097 #endif /* !flstring_h */
00098 
00099 /*
00100  * End of "$Id$".
00101  */
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.