diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2025-09-20 19:20:03 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2025-09-20 19:20:03 +0200 |
| commit | b45d74b60dfb7e23911df6b0523890e42f711267 (patch) | |
| tree | 42bb5764b05bd3bc5bffadb55f4375e6dce8a521 /app/bin/stringxtc.c | |
| parent | 6c1a798b0302034a7fdcaf93b8f014e2e458c2a0 (diff) | |
| parent | 63ec5715054be18ac4db5675e067b41c955d03b9 (diff) | |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'app/bin/stringxtc.c')
| -rw-r--r-- | app/bin/stringxtc.c | 25 |
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'; + } +} + + |
