Mercurial > projects > pwm
diff pwm.c @ 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 |
line wrap: on
line diff
--- 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);