8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sendmail / include / sm / string.h
blob81ace73ae480ea16a8c40c62128b7d47be34d1e1
1 /*
2 * Copyright (c) 2000-2001, 2003 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.38 2003/10/10 17:56:57 ca Exp $
12 #pragma ident "%Z%%M% %I% %E% SMI"
15 ** libsm string manipulation
18 #ifndef SM_STRING_H
19 # define SM_STRING_H
21 # include <sm/gen.h>
22 # include <sm/varargs.h>
23 # include <string.h> /* strlc{py,at}, strerror */
25 /* return number of bytes left in a buffer */
26 #define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
28 extern int PRINTFLIKE(3, 4)
29 sm_snprintf __P((char *, size_t, const char *, ...));
31 extern bool
32 sm_match __P((const char *_str, const char *_pattern));
34 extern char *
35 sm_strdup __P((char *));
37 extern char *
38 sm_strndup_x __P((const char *_str, size_t _len));
40 #if DO_NOT_USE_STRCPY
41 /* for "normal" data (free'd before end of process) */
42 extern char *
43 sm_strdup_x __P((const char *_str));
45 /* for data that is supposed to be persistent. */
46 extern char *
47 sm_pstrdup_x __P((const char *_str));
49 extern char *
50 sm_strdup_tagged_x __P((const char *str, char *file, int line, int group));
52 #else /* DO_NOT_USE_STRCPY */
54 /* for "normal" data (free'd before end of process) */
55 # define sm_strdup_x(str) strcpy(sm_malloc_x(strlen(str) + 1), str)
57 /* for data that is supposed to be persistent. */
58 # define sm_pstrdup_x(str) strcpy(sm_pmalloc_x(strlen(str) + 1), str)
60 # define sm_strdup_tagged_x(str, file, line, group) \
61 strcpy(sm_malloc_tagged_x(strlen(str) + 1, file, line, group), str)
62 #endif /* DO_NOT_USE_STRCPY */
64 extern char *
65 sm_stringf_x __P((const char *_fmt, ...));
67 extern char *
68 sm_vstringf_x __P((const char *_fmt, va_list _ap));
70 extern size_t
71 sm_strlcpy __P((char *_dst, const char *_src, ssize_t _len));
73 extern size_t
74 sm_strlcat __P((char *_dst, const char *_src, ssize_t _len));
76 extern size_t
77 sm_strlcat2 __P((char *, const char *, const char *, ssize_t));
79 extern size_t
80 #ifdef __STDC__
81 sm_strlcpyn(char *dst, ssize_t len, int n, ...);
82 #else /* __STDC__ */
83 sm_strlcpyn __P((char *,
84 ssize_t,
85 int,
86 va_dcl));
87 #endif /* __STDC__ */
89 # if !HASSTRERROR
90 extern char *
91 strerror __P((int _errno));
92 # endif /* !HASSTRERROR */
94 extern int
95 sm_strrevcmp __P((const char *, const char *));
97 extern int
98 sm_strrevcasecmp __P((const char *, const char *));
100 extern int
101 sm_strcasecmp __P((const char *, const char *));
103 extern int
104 sm_strncasecmp __P((const char *, const char *, size_t));
106 extern LONGLONG_T
107 sm_strtoll __P((const char *, char**, int));
109 extern ULONGLONG_T
110 sm_strtoull __P((const char *, char**, int));
112 extern void
113 stripquotes __P((char *));
115 #endif /* SM_STRING_H */