2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
7 * Copyright (c) 1983 Regents of the University of California.
8 * All rights reserved. The Berkeley software License Agreement
9 * specifies the terms and conditions for redistribution.
12 #pragma ident "%Z%%M% %I% %E% SMI"
15 * Routines for dialing up on DN-11
21 static sigjmp_buf jmpbuf
;
22 static int child
= -1, dn
;
25 dn_dialer(char *num
, char *acu
)
31 if (boolean(value(VERBOSE
)))
32 (void) printf("\nstarting call...");
33 if ((dn
= open(acu
, O_WRONLY
)) < 0) {
35 (void) printf("line busy...");
37 (void) printf("acu open error...");
40 if (sigsetjmp(jmpbuf
, 1)) {
41 (void) kill(child
, SIGKILL
);
45 (void) signal(SIGALRM
, (sig_handler_t
)alarmtr
);
46 timelim
= 5 * strlen(num
);
47 (void) alarm(timelim
< 30 ? 30 : timelim
);
48 if ((child
= fork()) == 0) {
50 * ignore this stuff for aborts
52 (void) signal(SIGALRM
, SIG_IGN
);
53 (void) signal(SIGINT
, SIG_IGN
);
54 (void) signal(SIGQUIT
, SIG_IGN
);
56 nw
= write(dn
, num
, lt
= strlen(num
));
60 * open line - will return on carrier
62 if ((FD
= open(DV
, O_RDWR
)) < 0) {
64 (void) printf("lost carrier...");
66 (void) printf("dialup line open failed...");
68 (void) kill(child
, SIGKILL
);
73 (void) ioctl(dn
, TCGETS
, &buf
);
75 (void) ioctl(dn
, TCSETSF
, &buf
);
76 (void) signal(SIGALRM
, SIG_DFL
);
77 while ((nw
= wait(<
)) != child
&& nw
!= -1)
79 (void) fflush(stdout
);
93 siglongjmp(jmpbuf
, 1);
97 * Insurance, for some reason we don't seem to be
107 (void) ioctl(FD
, TIOCMBIC
, &dtr
);
118 (void) kill(child
, SIGKILL
);
122 (void) ioctl(FD
, TIOCMBIC
, &dtr
);