scribo

Email-based phlog generator
git clone git://git.z3bra.org/scribo.git
Log | Files | Refs

commit 912d1da6b656d8907c7ff2478d3c1f5aab25d1ec
parent ac1e342e757a884e380fa4c60991f4270f47d7ea
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon,  7 Sep 2020 23:36:39 +0200

Format file output and dump body as-is

Diffstat:
Mscribo.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/scribo.c b/scribo.c @@ -123,6 +123,9 @@ writelog(FILE *in, FILE *out, struct headers *head) char stamp[BUFSIZ]; char *subject, *date, *from; + ssize_t len; + char buf[BUFSIZ]; + subject = header(head, "Subject"); date = header(head, "Date"); from = header(head, "From"); @@ -131,10 +134,13 @@ writelog(FILE *in, FILE *out, struct headers *head) strptime(date, "%a, %d %b %Y %T %z", &tm); strftime(stamp, sizeof(stamp), datefmt, &tm); - fprintf(out, "Title: %s\n", subject); - fprintf(out, "Date: %s\n", stamp); - fprintf(out, "Author: %s\n", from); - fprintf(out, "\n"); + fprintf(out, "%69s\n", subject); + fprintf(out, "──────────────────────────────────────────────────────────────────────\n"); + + while ((len = fread(buf, 1, sizeof(buf), in))) + fwrite(buf, 1, len, out); + + fprintf(out, "\n%s\n", stamp); return 0; }