xref: /freebsd/contrib/sendmail/include/sm/ixlen.h (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
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 int	uxtext_unquote __P((const char *, char *, int));
31 extern char	*sm_lowercase  __P((const char *));
32 extern bool	utf8_valid  __P((const char *, size_t));
33 # endif
34 
35 #else /* _FFR_8BITENVADDR */
36 # define XLENDECL int xlen = 0;
37 # define XLENRESET xlen = 0
38 # define XLEN(c) ++xlen
39 # define ilenx(str) strlen(str)
40 # define xleni(str) strlen(str)
41 #endif /* _FFR_8BITENVADDR */
42 
43 #endif /* ! _SM_IXLEN_H */
44