* Copyright (c) 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char copyright
[] =
"@(#) Copyright (c) 1989, 1991, 1993\n\
The Regents of the University of California. All rights reserved.\n";
static char sccsid
[] = "@(#)stty.c 8.1 (Berkeley) %G%";
strspn(argv
[optind
], "-aefg") == strlen(argv
[optind
]) &&
(ch
= getopt(argc
, argv
, "aef:g")) != EOF
)
case 'a': /* undocumented: POSIX compatibility */
if ((i
.fd
= open(optarg
, O_RDONLY
| O_NONBLOCK
)) < 0)
if (ioctl(i
.fd
, TIOCGETD
, &i
.ldisc
) < 0)
if (tcgetattr(i
.fd
, &i
.t
) < 0)
if (ioctl(i
.fd
, TIOCGWINSZ
, &i
.win
) < 0)
warn("TIOCGWINSZ: %s\n", strerror(errno
));
checkredirect(); /* conversion aid */
print(&i
.t
, &i
.win
, i
.ldisc
, fmt
);
gprint(&i
.t
, &i
.win
, i
.ldisc
);
for (i
.set
= i
.wset
= 0; *argv
; ++argv
) {
cfsetospeed(&i
.t
, speed
);
cfsetispeed(&i
.t
, speed
);
if (!strncmp(*argv
, "gfmt1", sizeof("gfmt1") - 1)) {
gread(&i
.t
, *argv
+ sizeof("gfmt1") - 1);
warnx("illegal option -- %s", *argv
);
if (i
.set
&& tcsetattr(i
.fd
, 0, &i
.t
) < 0)
if (i
.wset
&& ioctl(i
.fd
, TIOCSWINSZ
, &i
.win
) < 0)
"usage: stty: [-a|-e|-g] [-f file] [options]\n");