]> diplodocus.org Git - nmh/blobdiff - sbr/trimcpy.c
Whoops, turns out I originally ran this test with XOAUTH set. Fix the
[nmh] / sbr / trimcpy.c
index 6bcf3aec693d3002bd934ee2513f56277bb50d86..7a2ac03abecf05f4553a7511cb39393b7287b300 100644 (file)
@@ -72,3 +72,25 @@ cpytrim (const char *sp) {
 
     return dp;
 }
+
+
+/*
+ * rtrim() -- modify the argument to:
+ *         -- strip trailing whitespace
+ *
+ * This code is Copyright (c) 2014, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
+ */
+char *
+rtrim (char *sp) {
+    char *cp;
+
+    /* start at the end and zap trailing whitespace */
+    for (cp = sp + strlen (sp) - 1;
+         cp >= sp  &&  isspace ((unsigned char) *cp);
+         --cp) { continue; }
+    *++cp = '\0';
+
+    return sp;
+}