xref: /freebsd/contrib/sendmail/include/sm/ixlen.h (revision 6580f5c38dd5b01aeeaed16b370f1a12423437f0)
1 /*
2  * Copyright (c) 2020 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
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.
8  */
9 
10 #ifndef _SM_IXLEN_H
11 # define _SM_IXLEN_H 1
12 
13 #define SM_IS_MQ(ch) (((ch) & 0377) == METAQUOTE)
14 
15 #if _FFR_8BITENVADDR
16 # define XLENDECL bool mq=false;	\
17 	int xlen = 0;
18 # define XLENRESET mq=false, xlen = 0
19 # define XLEN(c) do { \
20 		if (mq) { ++xlen; mq=false; } \
21 		else if (SM_IS_MQ(c)) mq=true; \
22 		else ++xlen; \
23 	} while (0)
24 
25 extern int ilenx __P((const char *));
26 extern int xleni __P((const char *));
27 
28 # if USE_EAI
29 extern bool	asciistr __P((const char *));
30 extern bool	asciinstr __P((const char *, size_t));
31 extern int	uxtext_unquote __P((const char *, char *, int));
32 extern char	*sm_lowercase  __P((const char *));
33 extern bool	utf8_valid  __P((const char *, size_t));
34 # endif
35 
36 #else /* _FFR_8BITENVADDR */
37 # define XLENDECL int xlen = 0;
38 # define XLENRESET xlen = 0
39 # define XLEN(c) ++xlen
40 # define ilenx(str) strlen(str)
41 # define xleni(str) strlen(str)
42 #endif /* _FFR_8BITENVADDR */
43 
44 #endif /* ! _SM_IXLEN_H */
45