summaryrefslogtreecommitdiff
path: root/app/bin/stringxtc.c
diff options
context:
space:
mode:
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';
+ }
+}
+
+