1*2fb4f839SGregory Neil Shapiro /* 2*2fb4f839SGregory Neil Shapiro * Copyright (c) 2020 Proofpoint, Inc. and its suppliers. 3*2fb4f839SGregory Neil Shapiro * All rights reserved. 4*2fb4f839SGregory Neil Shapiro * 5*2fb4f839SGregory Neil Shapiro * By using this file, you agree to the terms and conditions set 6*2fb4f839SGregory Neil Shapiro * forth in the LICENSE file which can be found at the top level of 7*2fb4f839SGregory Neil Shapiro * the sendmail distribution. 8*2fb4f839SGregory Neil Shapiro * 9*2fb4f839SGregory Neil Shapiro */ 10*2fb4f839SGregory Neil Shapiro 11*2fb4f839SGregory Neil Shapiro #include <sm/gen.h> 12*2fb4f839SGregory Neil Shapiro #include <sm/sendmail.h> 13*2fb4f839SGregory Neil Shapiro #include <sm/ixlen.h> 14*2fb4f839SGregory Neil Shapiro 15*2fb4f839SGregory Neil Shapiro #if _FFR_8BITENVADDR 16*2fb4f839SGregory Neil Shapiro /* 17*2fb4f839SGregory Neil Shapiro ** XLENI -- determine the 'i'internal length of a string in e'x'ternal format 18*2fb4f839SGregory Neil Shapiro ** 19*2fb4f839SGregory Neil Shapiro ** Parameters: 20*2fb4f839SGregory Neil Shapiro ** str -- string [x] 21*2fb4f839SGregory Neil Shapiro ** 22*2fb4f839SGregory Neil Shapiro ** Returns: 23*2fb4f839SGregory Neil Shapiro ** 'i'internal length of a string in e'x'ternal format 24*2fb4f839SGregory Neil Shapiro */ 25*2fb4f839SGregory Neil Shapiro 26*2fb4f839SGregory Neil Shapiro int xleni(str)27*2fb4f839SGregory Neil Shapiroxleni(str) 28*2fb4f839SGregory Neil Shapiro const char *str; 29*2fb4f839SGregory Neil Shapiro { 30*2fb4f839SGregory Neil Shapiro char c; 31*2fb4f839SGregory Neil Shapiro int idx, ilen; 32*2fb4f839SGregory Neil Shapiro 33*2fb4f839SGregory Neil Shapiro if (NULL == str) 34*2fb4f839SGregory Neil Shapiro return -1; 35*2fb4f839SGregory Neil Shapiro for (ilen = 0, idx = 0; (c = str[idx]) != '\0'; ilen++, idx++) 36*2fb4f839SGregory Neil Shapiro { 37*2fb4f839SGregory Neil Shapiro if (SM_MM_QUOTE(c)) 38*2fb4f839SGregory Neil Shapiro ilen++; 39*2fb4f839SGregory Neil Shapiro } 40*2fb4f839SGregory Neil Shapiro 41*2fb4f839SGregory Neil Shapiro return ilen; 42*2fb4f839SGregory Neil Shapiro } 43*2fb4f839SGregory Neil Shapiro #endif /* _FFR_8BITENVADDR */ 44