X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Freset_cmd.c;h=e740fa667921e12fee6eab7fd20fb0d13ddd2159;hp=2e118ae58bae9ad55b10cf47a950cd165e74f0f1;hb=643ec2bf782cd02efafe3ccdeaea8920a404645e;hpb=790a85dbd4a81d5f5d8dd02a44d84f01512ef443 diff --git a/progs/reset_cmd.c b/progs/reset_cmd.c index 2e118ae5..e740fa66 100644 --- a/progs/reset_cmd.c +++ b/progs/reset_cmd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2021 Thomas E. Dickey * * Copyright 2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -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.21 2020/05/27 23:46:20 tom Exp $") +MODULE_ID("$Id: reset_cmd.c,v 1.27 2021/09/04 10:29:59 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -80,7 +80,7 @@ static FILE *my_file; static bool use_reset = FALSE; /* invoked as reset */ static bool use_init = FALSE; /* invoked as init */ -static void +static GCC_NORETURN void failed(const char *msg) { int code = errno; @@ -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) { @@ -363,6 +363,13 @@ default_erase(void) void set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) { +#if defined(EXP_WIN32_DRIVER) + /* noop */ + (void) tty_settings; + (void) my_erase; + (void) my_intr; + (void) my_kill; +#else if (DISABLED(tty_settings->c_cc[VERASE]) || my_erase >= 0) { tty_settings->c_cc[VERASE] = UChar((my_erase >= 0) ? my_erase @@ -380,6 +387,7 @@ set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) ? my_kill : CKILL); } +#endif } /* @@ -389,6 +397,9 @@ set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) void set_conversions(TTY * tty_settings) { +#if defined(EXP_WIN32_DRIVER) + /* FIXME */ +#else #ifdef ONLCR tty_settings->c_oflag |= ONLCR; #endif @@ -412,6 +423,7 @@ set_conversions(TTY * tty_settings) tty_settings->c_oflag &= ~OXTABS; #endif /* OXTABS */ tty_settings->c_lflag |= (ECHOE | ECHOK); +#endif } static bool @@ -551,15 +563,23 @@ show_tty_change(TTY * old_settings, int which, unsigned def) { - unsigned older, newer; + unsigned older = 0, newer = 0; char *p; +#if defined(EXP_WIN32_DRIVER) + /* noop */ + (void) old_settings; + (void) new_settings; + (void) name; + (void) which; + (void) def; +#else newer = new_settings->c_cc[which]; older = old_settings->c_cc[which]; if (older == newer && older == def) return; - +#endif (void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); if (DISABLED(newer)) { @@ -603,9 +623,13 @@ reset_flush(void) void print_tty_chars(TTY * old_settings, TTY * new_settings) { +#if defined(EXP_WIN32_DRIVER) + /* noop */ +#else show_tty_change(old_settings, new_settings, "Erase", VERASE, CERASE); show_tty_change(old_settings, new_settings, "Kill", VKILL, CKILL); show_tty_change(old_settings, new_settings, "Interrupt", VINTR, CINTR); +#endif } #if HAVE_SIZECHANGE