summaryrefslogtreecommitdiff
path: root/app/bin/stringxtc.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2025-09-20 19:19:34 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2025-09-20 19:19:34 +0200
commite7d20cf352688bf717a01f4e6d9e6f497c2bea4c (patch)
treecfd2ef9b569f49af985a6f1ec44f2614f63c8e78 /app/bin/stringxtc.c
parenta14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 (diff)
New upstream version 5.3.1Beta2upstream/5.3.1Beta2
Diffstat (limited to 'app/bin/stringxtc.c')
-rw-r--r--app/bin/stringxtc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/bin/stringxtc.c b/app/bin/stringxtc.c
index e65a97d..28eb9b4 100644
--- a/app/bin/stringxtc.c
+++ b/app/bin/stringxtc.c
@@ -143,3 +143,28 @@ XtcStricmp(const char *a, const char *b)
return ca - cb;
}
+
+/**
+ * Strip single trailing CR/LF characters from string. Multiple occurences
+ * will be ignored.
+ *
+ * \param line string to be checked. CR/LF are removed in place
+ */
+
+void Stripcr(char* line)
+{
+ char* cp;
+ cp = line + strlen(line);
+ if (cp == line) {
+ return;
+ }
+ cp--;
+ if (*cp == '\n') {
+ *cp-- = '\0';
+ }
+ if (cp >= line && *cp == '\r') {
+ *cp = '\0';
+ }
+}
+
+