As we already have the dump() function we can move the modification check inside the new dump() function. --- ed.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ed.c b/ed.c index eaa4ca9..0705beb 100644 --- a/ed.c +++ b/ed.c @@ -710,6 +710,9 @@ dump(void) { char *home; + if (modflag) + return; + line1 = nextln(0); line2 = lastln; @@ -730,9 +733,8 @@ static void chksignals(void) { if (hup) { - if (modflag) - dump(); exstatus = 1; + dump(); quit(); } -- 2.37.3