2 * Copyright 2006 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"
20 * Botch the interface to look like cu's
23 cumain(int argc
, char *argv
[])
30 (void) fprintf(stderr
,
31 "usage: cu telno [-t] [-s speed] [-a acu] [-l line] [-#]\n");
35 for (; argc
> 1; argv
++, argc
--) {
36 if (argv
[1][0] != '-')
38 else if (argv
[1][1] != '\0' && argv
[1][2] != '\0') {
39 (void) fprintf(stderr
,
40 "cu: extra characters after flag: %s\n",
43 } else switch (argv
[1][1]) {
51 CU
= argv
[2]; ++argv
; --argc
;
57 if (speed(atoi(argv
[2])) == 0) {
58 (void) fprintf(stderr
,
59 "cu: unsupported speed %s\n",
63 BR
= atoi(argv
[2]); ++argv
; --argc
;
67 DV
= argv
[2]; ++argv
; --argc
;
70 case '0': case '1': case '2': case '3': case '4':
71 case '5': case '6': case '7': case '8': case '9':
73 CU
[strlen(CU
)-1] = argv
[1][1];
75 DV
[strlen(DV
)-1] = argv
[1][1];
79 (void) fprintf(stderr
, "cu: bad flag %s\n", argv
[1]);
83 (void) signal(SIGINT
, (sig_handler_t
)cleanup
);
84 (void) signal(SIGQUIT
, (sig_handler_t
)cleanup
);
85 (void) signal(SIGHUP
, (sig_handler_t
)cleanup
);
86 (void) signal(SIGTERM
, (sig_handler_t
)cleanup
);
89 * The "cu" host name is used to define the
90 * attributes of the generic dialer.
92 (void) snprintf(sbuf
, sizeof (sbuf
), "cu%d", BR
);
93 if ((i
= hunt(sbuf
)) == 0) {
94 (void) printf("all ports busy\n");
98 (void) printf("link down\n");
102 setbuf(stdout
, NULL
);
111 boolean(value(VERBOSE
)) = 0;
115 (void) printf("Connect failed\n");