top: do not add an extra line when rewritting a rcfile

When the configuration file is first written, there is
just the normal single newline which ends that rcfile.

However, when any existing rcfile was rewritten, there
was one extra newline '\n' character added at the end.
This will happen just once. The file does NOT continue
to grow with the extra blank lines always being added.

Anyway, this patch will put an end to such a practice.

[ along the way i fixed an unrelated whitespace oops ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-03-17 00:00:00 -05:00 committed by Craig Small
parent 212de8cf8c
commit 255383a8cd
2 changed files with 2 additions and 2 deletions

View File

@ -5079,7 +5079,7 @@ static void write_rcfile (void) {
fprintf(fp, Osel_delim_2_txt); fprintf(fp, Osel_delim_2_txt);
} }
if (Inspect.raw) if (Inspect.raw && strcmp(Inspect.raw, "\n"))
fputs(Inspect.raw, fp); fputs(Inspect.raw, fp);
fclose(fp); fclose(fp);

View File

@ -509,7 +509,7 @@ typedef struct WIN_t {
#define RCF_PLUS_H "\\]^_`abcdefghij" #define RCF_PLUS_H "\\]^_`abcdefghij"
#define RCF_PLUS_J "klmnopqrstuvwxyz" #define RCF_PLUS_J "klmnopqrstuvwxyz"
// this next guy must never, ever change // this next guy must never, ever change
// ( we transition from'char' to 'int' ) // ( transitioned from 'char' to 'int' )
#define RCF_XFORMED_ID 'k' #define RCF_XFORMED_ID 'k'
// this next guy is incremented when columns change // this next guy is incremented when columns change
// ( to prevent older top versions from accessing ) // ( to prevent older top versions from accessing )