Mercurial > projects > pwm
changeset 21:ee4d36c85287
Make EOF in interactive mode equivalent to the q command
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Wed, 06 Sep 2017 16:41:58 +0200 |
parents | efef93e54c5f |
children | ec01c579024a |
files | pwm.1.xml pwm.c |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ </cmdsynopsis> <cmdsynopsis> <command>q</command> + </cmdsynopsis> + <cmdsynopsis> + <keysym>end-of-file</keysym> <sbr/> </cmdsynopsis> <para>Quit <command>pwm</command>. If running in interactive mode
--- 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);