diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-10-08 22:47:13 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-10-08 22:47:13 +0000 |
commit | 457e19a5caf834be99ae13c3efc359a02a42fb20 (patch) | |
tree | 244a1ee1210da4e47f53ccd339625b8a9f03b00e /usr.bin/tset/tset.c | |
parent | a6de1b801fa82570ef7457ae6e5188ebc7f5d93e (diff) |
update to ncurses-5.1-20001007
Diffstat (limited to 'usr.bin/tset/tset.c')
-rw-r--r-- | usr.bin/tset/tset.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c index 1488060a31a..9b4451fa488 100644 --- a/usr.bin/tset/tset.c +++ b/usr.bin/tset/tset.c @@ -101,8 +101,9 @@ char *ttyname(int fd); #include <curses.h> /* for bool typedef */ #include <dump_entry.h> +#include <transform.h> -MODULE_ID("$From: tset.c,v 0.42 2000/07/09 23:17:34 tom Exp $") +MODULE_ID("$From: tset.c,v 0.47 2000/10/08 01:01:08 tom Exp $") extern char **environ; @@ -113,9 +114,9 @@ const char *_nc_progname = "tset"; static TTY mode, oldmode; +static bool isreset = FALSE; /* invoked as reset */ static int terasechar = -1; /* new erase character */ static int intrchar = -1; /* new interrupt character */ -static int isreset; /* invoked as reset */ static int tkillchar = -1; /* new kill character */ static int tlines, tcolumns; /* window size */ @@ -233,7 +234,7 @@ typedef struct map { const char *porttype; /* Port type, or "" for any. */ const char *type; /* Terminal type to select. */ int conditional; /* Baud rate conditionals bitmask. */ - speed_t speed; /* Baud rate to compare against. */ + int speed; /* Baud rate to compare against. */ } MAP; static MAP *cur, *maplist; @@ -514,10 +515,7 @@ get_termcap_entry(char *userarg) goto map; if ((ttypath = ttyname(STDERR_FILENO)) != 0) { - if ((p = strrchr(ttypath, '/')) != 0) - ++p; - else - p = ttypath; + p = _nc_basename(ttypath); #if HAVE_GETTTYNAM /* * We have the 4.3BSD library call getttynam(3); that means @@ -591,15 +589,15 @@ get_termcap_entry(char *userarg) } /* Find the terminfo entry. If it doesn't exist, ask the user. */ while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, - &errret)) != OK) { + &errret)) != OK) { if (errret == 0) { (void) fprintf(stderr, "tset: unknown terminal type %s\n", - ttype); + ttype); ttype = 0; } else { (void) fprintf(stderr, - "tset: can't initialize terminal type %s (error %d)\n", - ttype, errret); + "tset: can't initialize terminal type %s (error %d)\n", + ttype, errret); ttype = 0; } ttype = askuser(ttype); @@ -692,46 +690,46 @@ reset_mode(void) mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR #ifdef IUCLC - | IUCLC + | IUCLC #endif #ifdef IXANY - | IXANY + | IXANY #endif - | IXOFF); + | IXOFF); mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL - | IMAXBEL + | IMAXBEL #endif ); mode.c_oflag &= ~(0 #ifdef OLCUC - | OLCUC + | OLCUC #endif #ifdef OCRNL - | OCRNL + | OCRNL #endif #ifdef ONOCR - | ONOCR + | ONOCR #endif #ifdef ONLRET - | ONLRET + | ONLRET #endif #ifdef OFILL - | OFILL + | OFILL #endif #ifdef OFDEL - | OFDEL + | OFDEL #endif #ifdef NLDLY - | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY + | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY #endif ); mode.c_oflag |= (OPOST #ifdef ONLCR - | ONLCR + | ONLCR #endif ); @@ -739,22 +737,22 @@ reset_mode(void) mode.c_cflag |= (CS8 | CREAD); mode.c_lflag &= ~(ECHONL | NOFLSH #ifdef TOSTOP - | TOSTOP + | TOSTOP #endif #ifdef ECHOPTR - | ECHOPRT + | ECHOPRT #endif #ifdef XCASE - | XCASE + | XCASE #endif ); mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK #ifdef ECHOCTL - | ECHOCTL + | ECHOCTL #endif #ifdef ECHOKE - | ECHOKE + | ECHOKE #endif ); #endif @@ -987,8 +985,8 @@ report(const char *name, int which, unsigned def) if (newer == 0177) (void) fprintf(stderr, "delete.\n"); else if ((p = key_backspace) != 0 - && newer == (unsigned char) p[0] - && p[1] == '\0') + && newer == (unsigned char) p[0] + && p[1] == '\0') (void) fprintf(stderr, "backspace.\n"); else if (newer < 040) { newer ^= 0100; @@ -1036,7 +1034,7 @@ static void usage(const char *pname) { (void) fprintf(stderr, - "usage: %s [-IQrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); + "usage: %s [-IQVrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); exit(EXIT_FAILURE); } @@ -1072,18 +1070,15 @@ main(int argc, char **argv) ospeed = mode.sg_ospeed; #endif - if ((p = strrchr(*argv, '/')) != 0) - ++p; - else - p = *argv; - if (!CaselessCmp(p, "reset")) { - isreset = 1; + p = _nc_basename(*argv); + if (!strcmp(p, PROG_RESET)) { + isreset = TRUE; reset_mode(); } obsolete(argv); noinit = noset = quiet = Sflag = sflag = showterm = 0; - while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrs")) != -1) { + while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrsV")) != -1) { switch (ch) { case 'q': /* display term only */ noset = 1; @@ -1126,6 +1121,9 @@ main(int argc, char **argv) case 's': /* output TERM set command */ sflag = 1; break; + case 'V': + puts(curses_version()); + return EXIT_SUCCESS; case '?': default: usage(*argv); |