aboutsummaryrefslogtreecommitdiff
path: root/contrib/sendmail/libsm/xleni.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/libsm/xleni.c')
-rw-r--r--contrib/sendmail/libsm/xleni.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/contrib/sendmail/libsm/xleni.c b/contrib/sendmail/libsm/xleni.c
new file mode 100644
index 000000000000..3d0b9d94d24e
--- /dev/null
+++ b/contrib/sendmail/libsm/xleni.c
@@ -0,0 +1,43 @@
+/*
+ * 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 */