# HG changeset patch # User Guido Berhoerster # Date 1504708918 -7200 # Node ID ee4d36c852871aeddb189917087b613de09b3858 # Parent efef93e54c5fd9344e02b459bf73731b526486ba Make EOF in interactive mode equivalent to the q command diff -r efef93e54c5f -r ee4d36c85287 pwm.1.xml --- a/pwm.1.xml Wed Sep 06 13:56:11 2017 +0200 +++ b/pwm.1.xml Wed Sep 06 16:41:58 2017 +0200 @@ -528,6 +528,9 @@ q + + + end-of-file Quit pwm. If running in interactive mode diff -r efef93e54c5f -r ee4d36c85287 pwm.c --- a/pwm.c Wed Sep 06 13:56:11 2017 +0200 +++ b/pwm.c Wed Sep 06 16:41:58 2017 +0200 @@ -140,7 +140,14 @@ /* line was truncated in non-interactive mode */ fprintf(stderr, "line too long\n"); goto out; - case IO_EOF: /* FALLTHROUGH */ + case IO_EOF: + if (is_interactive) { + /* treat as "q" command */ + strcpy(buf, "q\n"); + io_retval = IO_OK; + break; + } + /* FALLTHORUGH */ case IO_SIGNAL: if (ctx->unsaved_changes) { pwfile_write_autosave_file(ctx);