freebsd-src/contrib/sendmail/libsm/xleni.c
Gregory Neil Shapiro 2fb4f839f3 Merge commit '28fbd2825d216dafca4d991ad96d05b312f4f9a3'
Merge vendor sendmail 8.17.1 into HEAD
2023-01-15 21:20:22 +00:00

44 lines
787 B
C

/*
* Copyright (c) 2020 Proofpoint, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
*/
#include <sm/gen.h>
#include <sm/sendmail.h>
#include <sm/ixlen.h>
#if _FFR_8BITENVADDR
/*
** XLENI -- determine the 'i'internal length of a string in e'x'ternal format
**
** Parameters:
** str -- string [x]
**
** Returns:
** 'i'internal length of a string in e'x'ternal format
*/
int
xleni(str)
const char *str;
{
char c;
int idx, ilen;
if (NULL == str)
return -1;
for (ilen = 0, idx = 0; (c = str[idx]) != '\0'; ilen++, idx++)
{
if (SM_MM_QUOTE(c))
ilen++;
}
return ilen;
}
#endif /* _FFR_8BITENVADDR */