* Copyright (c) 1988 Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"@(#) Copyright (c) 1988 Regents of the University of California.\n\
static char sccsid
[] = "@(#)slattach.c 4.3 (Berkeley) 6/30/88";
#define DEFAULT_BAUD 9600
char hostname
[MAXHOSTNAMELEN
];
register char *dev
= argv
[1];
if (argc
< 2 || argc
> 3) {
fprintf(stderr
, "usage: %s ttyname [baudrate]\n", argv
[0]);
speed
= argc
== 3 ? findspeed(atoi(argv
[2])) : findspeed(DEFAULT_BAUD
);
fprintf(stderr
, "unknown speed %s", argv
[2]);
if (strncmp("/dev/", dev
, 5)) {
(void)sprintf(devname
, "/dev/%s", dev
);
if ((fd
= open(dev
, O_RDWR
| O_NDELAY
)) < 0) {
sgtty
.sg_flags
= RAW
| ANYP
;
sgtty
.sg_ispeed
= sgtty
.sg_ospeed
= speed
;
if (ioctl(fd
, TIOCSETP
, &sgtty
) < 0) {
perror("ioctl(TIOCSETP)");
if (ioctl(fd
, TIOCSETD
, &slipdisc
) < 0) {
perror("ioctl(TIOCSETD)");
register struct sg_spds
*sp
;
while (sp
->sp_val
&& sp
->sp_val
!= speed
)