From 64b754a36c4b4ceaf55db13093ad482bb5bf8665 Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Wed, 10 Mar 2021 23:33:55 -0800 Subject: [PATCH] Fix issue display AREA keywords at beginning of body text or any lines that were only terminated with carriage-return (\r) since these are treated rather-oddly by the FTN software as a line-ending and line-feeds are to be ignored. So transfer \r to \n on output and ignore the \n's in the body text. --- src/sbbs3/pktdump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sbbs3/pktdump.c b/src/sbbs3/pktdump.c index f6bffc7af8..60b074c33e 100644 --- a/src/sbbs3/pktdump.c +++ b/src/sbbs3/pktdump.c @@ -73,7 +73,7 @@ const char* fmsgattr_str(uint16_t attr) int pktdump(FILE* fp, const char* fname, FILE* good, FILE* bad) { - int ch,lastch=0; + int ch,lastch; char buf[128]; char to[FIDO_NAME_LEN]; char from[FIDO_NAME_LEN]; @@ -240,6 +240,7 @@ int pktdump(FILE* fp, const char* fname, FILE* good, FILE* bad) fprintf(bodyfp,"\n-start of message text-\n"); size_t count = 0; + lastch = 0; while((ch=fgetc(fp))!=EOF && ch!=0) { count++; if((count == 1 || lastch == '\r') && ch == 1) { @@ -251,9 +252,8 @@ int pktdump(FILE* fp, const char* fname, FILE* good, FILE* bad) break; continue; } - if(lastch=='\r' && ch!='\n') - fputc('\n',bodyfp); - fputc(lastch=ch,bodyfp); + fputc(ch == '\r' ? '\n' : ch, bodyfp); + lastch = ch; if(good != NULL) fputc(ch, good); } -- GitLab