X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftic.c;h=c66a4ef4cdb93e97e82c8d2752c52043589193a6;hp=32ea4541ebe973d0fd720dabdca8a0375df0f47a;hb=1379ab3f6cc5b92256708ecc4129b57928d62cf4;hpb=4f56e7e405530c9c5e953d4072415429878b6e5b diff --git a/progs/tic.c b/progs/tic.c index 32ea4541..c66a4ef4 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.277 2019/06/29 23:23:22 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.281 2019/11/09 18:51:36 tom Exp $") #define STDIN_NAME "" @@ -218,7 +218,8 @@ write_it(ENTRY * ep) while ((ch = *t++) != 0) { *d++ = (char) ch; if (ch == '\\') { - *d++ = *t++; + if ((*d++ = *t++) == '\0') + break; } else if ((ch == '%') && (*t == L_BRACE)) { char *v = 0; @@ -1024,10 +1025,14 @@ main(int argc, char *argv[]) if (!quiet) { (void) fseek(tmp_fp, qp->cstart, SEEK_SET); while (j-- > 0) { - if (infodump) - (void) putchar(fgetc(tmp_fp)); - else - put_translate(fgetc(tmp_fp)); + int ch = fgetc(tmp_fp); + if (ch == EOF || ferror(tmp_fp)) { + break; + } else if (infodump) { + (void) putchar(ch); + } else { + put_translate(ch); + } } } @@ -2934,6 +2939,7 @@ check_termtype(TERMTYPE2 *tp, bool literal) * These are probably both or none. */ PAIRED(parm_index, parm_rindex); + PAIRED(parm_ich, parm_dch); /* * These may be mismatched because the terminal description relies on @@ -3050,7 +3056,7 @@ check_termtype(TERMTYPE2 *tp, bool literal) * ncurses handles it. */ if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode)) - && PRESENT(parm_ich)) { + && PRESENT(insert_character)) { _nc_warning("non-curses applications may be confused by ich1 with smir/rmir"); }