=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tset/tset.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/tset/tset.c 2000/07/24 04:06:12 1.19 --- src/usr.bin/tset/tset.c 2000/10/08 22:47:11 1.20 *************** *** 101,108 **** #include /* for bool typedef */ #include ! MODULE_ID("$From: tset.c,v 0.42 2000/07/09 23:17:34 tom Exp $") extern char **environ; --- 101,109 ---- #include /* for bool typedef */ #include + #include ! MODULE_ID("$From: tset.c,v 0.47 2000/10/08 01:01:08 tom Exp $") extern char **environ; *************** *** 113,121 **** static TTY mode, oldmode; 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 */ --- 114,122 ---- 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 tkillchar = -1; /* new kill character */ static int tlines, tcolumns; /* window size */ *************** *** 233,239 **** 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. */ } MAP; static MAP *cur, *maplist; --- 234,240 ---- const char *porttype; /* Port type, or "" for any. */ const char *type; /* Terminal type to select. */ int conditional; /* Baud rate conditionals bitmask. */ ! int speed; /* Baud rate to compare against. */ } MAP; static MAP *cur, *maplist; *************** *** 514,523 **** goto map; if ((ttypath = ttyname(STDERR_FILENO)) != 0) { ! if ((p = strrchr(ttypath, '/')) != 0) ! ++p; ! else ! p = ttypath; #if HAVE_GETTTYNAM /* * We have the 4.3BSD library call getttynam(3); that means --- 515,521 ---- goto map; if ((ttypath = ttyname(STDERR_FILENO)) != 0) { ! p = _nc_basename(ttypath); #if HAVE_GETTTYNAM /* * We have the 4.3BSD library call getttynam(3); that means *************** *** 591,605 **** } /* Find the terminfo entry. If it doesn't exist, ask the user. */ while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, ! &errret)) != OK) { if (errret == 0) { (void) fprintf(stderr, "tset: unknown terminal type %s\n", ! ttype); ttype = 0; } else { (void) fprintf(stderr, ! "tset: can't initialize terminal type %s (error %d)\n", ! ttype, errret); ttype = 0; } ttype = askuser(ttype); --- 589,603 ---- } /* Find the terminfo entry. If it doesn't exist, ask the user. */ while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, ! &errret)) != OK) { if (errret == 0) { (void) fprintf(stderr, "tset: unknown terminal type %s\n", ! ttype); ttype = 0; } else { (void) fprintf(stderr, ! "tset: can't initialize terminal type %s (error %d)\n", ! ttype, errret); ttype = 0; } ttype = askuser(ttype); *************** *** 692,737 **** mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR #ifdef IUCLC ! | IUCLC #endif #ifdef IXANY ! | IXANY #endif ! | IXOFF); mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL ! | IMAXBEL #endif ); mode.c_oflag &= ~(0 #ifdef OLCUC ! | OLCUC #endif #ifdef OCRNL ! | OCRNL #endif #ifdef ONOCR ! | ONOCR #endif #ifdef ONLRET ! | ONLRET #endif #ifdef OFILL ! | OFILL #endif #ifdef OFDEL ! | OFDEL #endif #ifdef NLDLY ! | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY #endif ); mode.c_oflag |= (OPOST #ifdef ONLCR ! | ONLCR #endif ); --- 690,735 ---- mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR #ifdef IUCLC ! | IUCLC #endif #ifdef IXANY ! | IXANY #endif ! | IXOFF); mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON #ifdef IMAXBEL ! | IMAXBEL #endif ); mode.c_oflag &= ~(0 #ifdef OLCUC ! | OLCUC #endif #ifdef OCRNL ! | OCRNL #endif #ifdef ONOCR ! | ONOCR #endif #ifdef ONLRET ! | ONLRET #endif #ifdef OFILL ! | OFILL #endif #ifdef OFDEL ! | OFDEL #endif #ifdef NLDLY ! | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY #endif ); mode.c_oflag |= (OPOST #ifdef ONLCR ! | ONLCR #endif ); *************** *** 739,760 **** mode.c_cflag |= (CS8 | CREAD); mode.c_lflag &= ~(ECHONL | NOFLSH #ifdef TOSTOP ! | TOSTOP #endif #ifdef ECHOPTR ! | ECHOPRT #endif #ifdef XCASE ! | XCASE #endif ); mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK #ifdef ECHOCTL ! | ECHOCTL #endif #ifdef ECHOKE ! | ECHOKE #endif ); #endif --- 737,758 ---- mode.c_cflag |= (CS8 | CREAD); mode.c_lflag &= ~(ECHONL | NOFLSH #ifdef TOSTOP ! | TOSTOP #endif #ifdef ECHOPTR ! | ECHOPRT #endif #ifdef XCASE ! | XCASE #endif ); mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK #ifdef ECHOCTL ! | ECHOCTL #endif #ifdef ECHOKE ! | ECHOKE #endif ); #endif *************** *** 987,994 **** if (newer == 0177) (void) fprintf(stderr, "delete.\n"); else if ((p = key_backspace) != 0 ! && newer == (unsigned char) p[0] ! && p[1] == '\0') (void) fprintf(stderr, "backspace.\n"); else if (newer < 040) { newer ^= 0100; --- 985,992 ---- if (newer == 0177) (void) fprintf(stderr, "delete.\n"); else if ((p = key_backspace) != 0 ! && newer == (unsigned char) p[0] ! && p[1] == '\0') (void) fprintf(stderr, "backspace.\n"); else if (newer < 040) { newer ^= 0100; *************** *** 1036,1042 **** usage(const char *pname) { (void) fprintf(stderr, ! "usage: %s [-IQrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); exit(EXIT_FAILURE); } --- 1034,1040 ---- usage(const char *pname) { (void) fprintf(stderr, ! "usage: %s [-IQVrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); exit(EXIT_FAILURE); } *************** *** 1072,1089 **** ospeed = mode.sg_ospeed; #endif ! if ((p = strrchr(*argv, '/')) != 0) ! ++p; ! else ! p = *argv; ! if (!CaselessCmp(p, "reset")) { ! isreset = 1; 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) { switch (ch) { case 'q': /* display term only */ noset = 1; --- 1070,1084 ---- ospeed = mode.sg_ospeed; #endif ! 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:qQSrsV")) != -1) { switch (ch) { case 'q': /* display term only */ noset = 1; *************** *** 1126,1131 **** --- 1121,1129 ---- case 's': /* output TERM set command */ sflag = 1; break; + case 'V': + puts(curses_version()); + return EXIT_SUCCESS; case '?': default: usage(*argv);