X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Freset_cmd.c;h=eff3af729e6090c75ac0737fb139aa482c80d89a;hp=d4420b7d5b64d94f9776b9fbfc223a8922da7067;hb=deb0d07e8eb4803b9e9653359eab17a30d04369d;hpb=c2650100f80134924eda8f22cd7cc1d1d919ee3d diff --git a/progs/reset_cmd.c b/progs/reset_cmd.c index d4420b7d..eff3af72 100644 --- a/progs/reset_cmd.c +++ b/progs/reset_cmd.c @@ -47,13 +47,13 @@ #endif #if NEED_PTEM_H -/* they neglected to define struct winsize in termios.h -- it's only +/* they neglected to define struct winsize in termios.h -- it is only in termio.h */ #include #include #endif -MODULE_ID("$Id: reset_cmd.c,v 1.25 2021/03/20 18:23:14 tom Exp $") +MODULE_ID("$Id: reset_cmd.c,v 1.28 2021/10/02 18:08:44 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -102,7 +102,7 @@ cat_file(char *file) bool sent = FALSE; if (file != 0) { - if ((fp = fopen(file, "r")) == 0) + if ((fp = safe_fopen(file, "r")) == 0) failed(file); while ((nr = fread(buf, sizeof(char), sizeof(buf), fp)) != 0) { @@ -193,7 +193,7 @@ out_char(int c) * a child program dies in raw mode. */ void -reset_tty_settings(int fd, TTY * tty_settings) +reset_tty_settings(int fd, TTY * tty_settings, int noset) { GET_TTY(fd, tty_settings); @@ -329,7 +329,9 @@ reset_tty_settings(int fd, TTY * tty_settings) ); #endif - SET_TTY(fd, tty_settings); + if (!noset) { + SET_TTY(fd, tty_settings); + } } /*