comparison 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
comparison
equal deleted inserted replaced
20:efef93e54c5f 21:ee4d36c85287
138 break; 138 break;
139 case IO_TRUNCATED: 139 case IO_TRUNCATED:
140 /* line was truncated in non-interactive mode */ 140 /* line was truncated in non-interactive mode */
141 fprintf(stderr, "line too long\n"); 141 fprintf(stderr, "line too long\n");
142 goto out; 142 goto out;
143 case IO_EOF: /* FALLTHROUGH */ 143 case IO_EOF:
144 if (is_interactive) {
145 /* treat as "q" command */
146 strcpy(buf, "q\n");
147 io_retval = IO_OK;
148 break;
149 }
150 /* FALLTHORUGH */
144 case IO_SIGNAL: 151 case IO_SIGNAL:
145 if (ctx->unsaved_changes) { 152 if (ctx->unsaved_changes) {
146 pwfile_write_autosave_file(ctx); 153 pwfile_write_autosave_file(ctx);
147 } 154 }
148 goto quit; 155 goto quit;