|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)cu.c 4.6 (Berkeley) 6/28/83";
3: #endif
4:
5: #include "tip.h"
6:
7: int cleanup();
8: int timeout();
9:
10: /*
11: * Botch the interface to look like cu's
12: */
13: cumain(argc, argv)
14: char *argv[];
15: {
16: register int i;
17: static char sbuf[12];
18:
19: if (argc < 2) {
1.1.1.2 ! root 20: printf("usage: cu telno [-t] [-s speed] [-a acu] [-l line] [-m minutes] [-#]\n");
1.1 root 21: exit(8);
22: }
23: CU = DV = NOSTR;
24: for (; argc > 1; argv++, argc--) {
25: if (argv[1][0] != '-')
26: PN = argv[1];
27: else switch (argv[1][1]) {
28:
29: case 't':
30: HW = 1, DU = -1;
31: --argc;
32: continue;
33:
34: case 'a':
35: CU = argv[2]; ++argv; --argc;
36: break;
37:
38: case 's':
39: if (speed(atoi(argv[2])) == 0) {
40: fprintf(stderr, "cu: unsupported speed %s\n",
41: argv[2]);
42: exit(3);
43: }
44: BR = atoi(argv[2]); ++argv; --argc;
45: break;
46:
47: case 'l':
48: DV = argv[2]; ++argv; --argc;
49: break;
50:
1.1.1.2 ! root 51: case 'm':
! 52: TO = atoi(argv[2]) * 60; ++argv; --argc;
! 53: break;
! 54:
1.1 root 55: case '0': case '1': case '2': case '3': case '4':
56: case '5': case '6': case '7': case '8': case '9':
57: if (CU)
58: CU[strlen(CU)-1] = argv[1][1];
59: if (DV)
60: DV[strlen(DV)-1] = argv[1][1];
61: break;
62:
63: default:
64: printf("Bad flag %s", argv[1]);
65: break;
66: }
67: }
68: signal(SIGINT, cleanup);
69: signal(SIGQUIT, cleanup);
70: signal(SIGHUP, cleanup);
71: signal(SIGTERM, cleanup);
72:
73: /*
74: * The "cu" host name is used to define the
75: * attributes of the generic dialer.
76: */
77: if ((i = hunt(sprintf(sbuf, "cu%d", BR))) == 0) {
78: printf("all ports busy\n");
79: exit(3);
80: }
81: if (i == -1) {
82: printf("link down\n");
83: delock(uucplock);
84: exit(3);
85: }
86: setbuf(stdout, NULL);
87: loginit();
88: setuid(getuid());
89: setgid(getgid());
90: vinit();
91: setparity("none");
92: boolean(value(VERBOSE)) = 0;
93: if (HW)
94: ttysetup(speed(BR));
95: if (connect()) {
96: printf("Connect failed\n");
97: delock(uucplock);
98: exit(1);
99: }
100: if (!HW)
101: ttysetup(speed(BR));
102: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.