X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftic.c;h=328bcd6b2772cbf7cb8ca0f379058049dc32f903;hp=32ea4541ebe973d0fd720dabdca8a0375df0f47a;hb=47d2fb4537d9ad5bb14f4810561a327930ca4280;hpb=4f56e7e405530c9c5e953d4072415429878b6e5b diff --git a/progs/tic.c b/progs/tic.c index 32ea4541..328bcd6b 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +49,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.282 2020/02/02 23:34:34 tom Exp $") #define STDIN_NAME "" @@ -218,7 +219,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 +1026,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 +2940,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 +3057,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"); }