]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/string.h
966068a9c6c3ced3f7e67ba1e768a2c5eb2fee4b
[thirdparty/cups.git] / cups / string.h
1 /*
2 * "$Id$"
3 *
4 * String definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 1997-2006 by Easy Software Products.
7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 *
24 * This file is subject to the Apple OS-Developed Software exception.
25 */
26
27 #ifndef _CUPS_STRING_H_
28 # define _CUPS_STRING_H_
29
30 /*
31 * Include necessary headers...
32 */
33
34 # include <stdio.h>
35 # include <stdlib.h>
36 # include <stdarg.h>
37 # include <ctype.h>
38 # include <locale.h>
39
40 # include <config.h>
41
42 # ifdef HAVE_STRING_H
43 # include <string.h>
44 # endif /* HAVE_STRING_H */
45
46 # ifdef HAVE_STRINGS_H
47 # include <strings.h>
48 # endif /* HAVE_STRINGS_H */
49
50 # ifdef HAVE_BSTRING_H
51 # include <bstring.h>
52 # endif /* HAVE_BSTRING_H */
53
54
55 /*
56 * Stuff for WIN32 and OS/2...
57 */
58
59 # if defined(WIN32) || defined(__EMX__)
60 # define strcasecmp stricmp
61 # define strncasecmp strnicmp
62 # endif /* WIN32 || __EMX__ */
63
64
65 /*
66 * C++ magic...
67 */
68
69 # ifdef __cplusplus
70 extern "C" {
71 # endif /* __cplusplus */
72
73
74 /*
75 * String pool structures...
76 */
77
78 typedef struct _cups_sp_item_s /**** String Pool Item ****/
79 {
80 char *str; /* String */
81 unsigned int ref_count; /* Reference count */
82 } _cups_sp_item_t;
83
84
85 /*
86 * Prototypes...
87 */
88
89 extern void _cups_strcpy(char *dst, const char *src);
90
91 # ifndef HAVE_STRDUP
92 extern char *_cups_strdup(const char *);
93 # define strdup _cups_strdup
94 # endif /* !HAVE_STRDUP */
95
96 # ifndef HAVE_STRCASECMP
97 extern int _cups_strcasecmp(const char *, const char *);
98 # define strcasecmp _cups_strcasecmp
99 # endif /* !HAVE_STRCASECMP */
100
101 # ifndef HAVE_STRNCASECMP
102 extern int _cups_strncasecmp(const char *, const char *, size_t n);
103 # define strncasecmp _cups_strncasecmp
104 # endif /* !HAVE_STRNCASECMP */
105
106 # ifndef HAVE_STRLCAT
107 extern size_t _cups_strlcat(char *, const char *, size_t);
108 # define strlcat _cups_strlcat
109 # endif /* !HAVE_STRLCAT */
110
111 # ifndef HAVE_STRLCPY
112 extern size_t _cups_strlcpy(char *, const char *, size_t);
113 # define strlcpy _cups_strlcpy
114 # endif /* !HAVE_STRLCPY */
115
116 # ifndef HAVE_SNPRINTF
117 extern int _cups_snprintf(char *, size_t, const char *, ...)
118 # ifdef __GNUC__
119 __attribute__ ((__format__ (__printf__, 3, 4)))
120 # endif /* __GNUC__ */
121 ;
122 # define snprintf _cups_snprintf
123 # endif /* !HAVE_SNPRINTF */
124
125 # ifndef HAVE_VSNPRINTF
126 extern int _cups_vsnprintf(char *, size_t, const char *, va_list);
127 # define vsnprintf _cups_vsnprintf
128 # endif /* !HAVE_VSNPRINTF */
129
130 /*
131 * String pool functions...
132 */
133
134 extern char *_cupsStrAlloc(const char *s);
135 extern void _cupsStrFlush(void);
136 extern void _cupsStrFree(const char *s);
137 extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
138
139
140 /*
141 * Floating point number functions...
142 */
143
144 extern char *_cupsStrFormatd(char *buf, char *bufend, double number,
145 struct lconv *loc);
146 extern double _cupsStrScand(const char *buf, char **bufptr,
147 struct lconv *loc);
148
149
150 /*
151 * C++ magic...
152 */
153
154 # ifdef __cplusplus
155 }
156 # endif /* __cplusplus */
157
158 #endif /* !_CUPS_STRING_H_ */
159
160 /*
161 * End of "$Id$".
162 */