+static int my_fputs(char *s, FILE *stream)
+{
+ char *p;
+
+ for (p = s + strlen(s) - 1; p >= s; p--)
+ if (!isspace(*p))
+ break;
+ p++;
+
+ /* use DOS endings for better viewer compatibility */
+ memcpy(p, "\r\n", 3);
+
+ return fputs(s, stream);
+}