home *** CD-ROM | disk | FTP | other *** search
- *** tcput.c.ansi Wed Apr 3 22:11:57 1991
- --- tcput.c Wed Apr 3 22:10:34 1991
- ***************
- *** 1,7 ****
- /*
- * tcput.c Find the given terminal capability in the termcap database,
- * interpet it, and print it to the terminal. Raw mode is used
- ! * when printing to avoid system-level mappings.
- *
- * Similar to tput on SYSV unix, but doesn't allow instantiation
- * of parameter strings from the command line.
- --- 1,8 ----
- /*
- * tcput.c Find the given terminal capability in the termcap database,
- * interpet it, and print it to the terminal. Raw mode is used
- ! * when printing to avoid system-level mappings, unless such
- ! * a change isn't supported (i.e., a socket is in use.)
- *
- * Similar to tput on SYSV unix, but doesn't allow instantiation
- * of parameter strings from the command line.
- ***************
- *** 12,21 ****
- #include <stdio.h>
- #include <sgtty.h>
- #include <sys/ioctl.h>
-
- #define PROG "tcput"
-
- ! void do_args(char **);
- void usage();
- char *getenv();
-
- --- 13,25 ----
- #include <stdio.h>
- #include <sgtty.h>
- #include <sys/ioctl.h>
- + #include <errno.h>
-
- + extern errno;
- +
- #define PROG "tcput"
-
- ! void do_args();
- void usage();
- char *getenv();
-
- ***************
- *** 25,31 ****
-
- int mputc();
-
- ! main(int argc, char **argv)
- {
- int val;
- char *cp = bp;
- --- 29,37 ----
-
- int mputc();
-
- ! main(argc, argv)
- ! int argc;
- ! char **argv;
- {
- int val;
- char *cp = bp;
- ***************
- *** 50,56 ****
- }
-
- void
- ! do_args(char **argv)
- {
- for (++argv; *argv != NULL && **argv == '-'; ++argv) switch(*++*argv) {
- case 'T':
- --- 56,63 ----
- }
-
- void
- ! do_args(argv)
- ! char **argv;
- {
- for (++argv; *argv != NULL && **argv == '-'; ++argv) switch(*++*argv) {
- case 'T':
- ***************
- *** 76,82 ****
- exit(1);
- }
-
- ! mputc(int c)
- {
- putchar(c);
- return 0;
- --- 83,89 ----
- exit(1);
- }
-
- ! mputc(c)
- {
- putchar(c);
- return 0;
- ***************
- *** 86,97 ****
- {
- struct sgttyb port;
-
- ! if (ioctl(0, TIOCGETP, &port) < 0) {
- perror("raw: stdin");
- exit(1);
- }
- port.sg_flags |= RAW;
- ! if (ioctl(0, TIOCSETP, &port) < 0) {
- perror("raw: stdin");
- exit(1);
- }
- --- 93,104 ----
- {
- struct sgttyb port;
-
- ! if (ioctl(0, TIOCGETP, &port) < 0 && errno != EOPNOTSUPP) {
- perror("raw: stdin");
- exit(1);
- }
- port.sg_flags |= RAW;
- ! if (ioctl(0, TIOCSETP, &port) < 0 && errno != EOPNOTSUPP) {
- perror("raw: stdin");
- exit(1);
- }
- ***************
- *** 101,112 ****
- {
- struct sgttyb port;
-
- ! if (ioctl(0, TIOCGETP, &port) < 0) {
- perror("noraw: stdin");
- exit(1);
- }
- port.sg_flags &= ~RAW;
- ! if (ioctl(0, TIOCSETP, &port) < 0) {
- perror("noraw: stdin");
- exit(1);
- }
- --- 108,119 ----
- {
- struct sgttyb port;
-
- ! if (ioctl(0, TIOCGETP, &port) < 0 && errno != EOPNOTSUPP) {
- perror("noraw: stdin");
- exit(1);
- }
- port.sg_flags &= ~RAW;
- ! if (ioctl(0, TIOCSETP, &port) < 0 && errno != EOPNOTSUPP) {
- perror("noraw: stdin");
- exit(1);
- }
-