Update zoneinfo database.
[dragonfly/netmp.git] / contrib / sendmail / include / sm / string.h
blobc8cb59f690e9fa521c43dae4e330a9f84ceaffea
1 /*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 * $Id: string.h,v 1.36 2001/06/17 21:31:11 ca Exp $
13 ** libsm string manipulation
16 #ifndef SM_STRING_H
17 # define SM_STRING_H
19 # include <sm/gen.h>
20 # include <sm/varargs.h>
21 # include <string.h> /* strlc{py,at}, strerror */
23 /* return number of bytes left in a buffer */
24 #define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
26 extern int PRINTFLIKE(3, 4)
27 sm_snprintf __P((
28 char *,
29 size_t,
30 const char *,
31 ...));
33 extern bool
34 sm_match __P((
35 const char *_str,
36 const char *_pattern));
38 extern char *
39 sm_strdup __P((
40 char *));
42 extern char *
43 sm_strndup_x __P((
44 const char *_str,
45 size_t _len));
47 /* for "normal" data (free'd before end of process) */
48 # define sm_strdup_x(str) strcpy(sm_malloc_x(strlen(str) + 1), str)
50 /* for data that is supposed to be persistent. */
51 # define sm_pstrdup_x(str) strcpy(sm_pmalloc_x(strlen(str) + 1), str)
53 # define sm_strdup_tagged_x(str, file, line, group) \
54 strcpy(sm_malloc_tagged_x(strlen(str) + 1, file, line, group), str)
56 extern char *
57 sm_stringf_x __P((
58 const char *_fmt,
59 ...));
61 extern char *
62 sm_vstringf_x __P((
63 const char *_fmt,
64 va_list _ap));
66 extern size_t
67 sm_strlcpy __P((
68 char *_dst,
69 const char *_src,
70 ssize_t _len));
72 extern size_t
73 sm_strlcat __P((
74 char *_dst,
75 const char *_src,
76 ssize_t _len));
78 extern size_t
79 sm_strlcat2 __P((
80 char *,
81 const char *,
82 const char *,
83 ssize_t));
85 extern size_t
86 #ifdef __STDC__
87 sm_strlcpyn(char *dst, ssize_t len, int n, ...);
88 #else /* __STDC__ */
89 sm_strlcpyn __P((char *,
90 ssize_t,
91 int,
92 va_dcl));
93 #endif /* __STDC__ */
95 # if !HASSTRERROR
96 extern char *
97 strerror __P((
98 int _errno));
99 # endif /* !HASSTRERROR */
101 extern int
102 sm_strrevcmp __P((
103 const char *,
104 const char *));
106 extern int
107 sm_strrevcasecmp __P((
108 const char *,
109 const char *));
111 extern int
112 sm_strcasecmp __P((
113 const char *,
114 const char *));
116 extern int
117 sm_strncasecmp __P((
118 const char *,
119 const char *,
120 size_t));
122 extern LONGLONG_T
123 sm_strtoll __P((
124 const char *,
125 char**, int));
127 extern ULONGLONG_T
128 sm_strtoull __P((
129 const char *,
130 char**, int));
132 extern void
133 stripquotes __P((char *));
135 #endif /* SM_STRING_H */