X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Freset_cmd.c;h=a4e44efc0f572b9d8abf572bdbe27684ce78ccfa;hp=4d05c6e985ef1d022197b45dc55ab6b5b03c1b80;hb=b0bdfbb1c78346047c54d8e516a104fcff586e52;hpb=93ed44d781ca36f55021e0ad55f1ce33de62f7ba diff --git a/progs/reset_cmd.c b/progs/reset_cmd.c index 4d05c6e9..a4e44efc 100644 --- a/progs/reset_cmd.c +++ b/progs/reset_cmd.c @@ -52,7 +52,7 @@ #include #endif -MODULE_ID("$Id: reset_cmd.c,v 1.12 2017/09/20 00:49:25 tom Exp $") +MODULE_ID("$Id: reset_cmd.c,v 1.13 2017/10/07 20:56:03 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -80,25 +80,15 @@ static bool use_reset = FALSE; /* invoked as reset */ static bool use_init = FALSE; /* invoked as init */ static void -exit_error(void) +failed(const char *msg) { + int code = errno; + + (void) fprintf(stderr, "%s: %s: %s\n", _nc_progname, msg, strerror(code)); restore_tty_settings(); (void) fprintf(my_file, "\n"); fflush(my_file); - ExitProgram(EXIT_FAILURE); - /* NOTREACHED */ -} - -static void -failed(const char *msg) -{ - char temp[BUFSIZ]; - - _nc_STRCPY(temp, _nc_progname, sizeof(temp)); - _nc_STRCAT(temp, ": ", sizeof(temp)); - _nc_STRNCAT(temp, msg, sizeof(temp), sizeof(temp) - strlen(temp) - 2); - perror(temp); - exit_error(); + ExitProgram(ErrSystem(code)); /* NOTREACHED */ }