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 11 #include <sm/gen.h> 12 #include <sm/sendmail.h> 13 #include <sm/ixlen.h> 14 15 #if _FFR_8BITENVADDR 16 /* 17 ** XLENI -- determine the 'i'internal length of a string in e'x'ternal format 18 ** 19 ** Parameters: 20 ** str -- string [x] 21 ** 22 ** Returns: 23 ** 'i'internal length of a string in e'x'ternal format 24 */ 25 26 int 27 xleni(str) 28 const char *str; 29 { 30 char c; 31 int idx, ilen; 32 33 if (NULL == str) 34 return -1; 35 for (ilen = 0, idx = 0; (c = str[idx]) != '\0'; ilen++, idx++) 36 { 37 if (SM_MM_QUOTE(c)) 38 ilen++; 39 } 40 41 return ilen; 42 } 43 #endif /* _FFR_8BITENVADDR */ 44