|
|
1.1 root 1: /*
2: * dcpmisc.c
3: *
4: * Miscellaneous Support Routines for uucico
5: */
6:
7: #include "dcp.h"
8:
9: usage()
10: {
11: fatal("\n\
12: Usage: uucico [-xn] [-r0] slave mode\n\
13: uucico [-xn] [-r1] -{sS}host call host\n\
14: uucico [-xn] [-r1] -{sS}all call all known hosts\n\
15: uucico [-xn] [-r1] -{c}all call known hosts only if files pending\n\
16: uucico [-xn] -r1 call uutouch queued hosts\n\
17: ");
18: }
19:
20: fatal(x)
21: {
22: printmsg(M_LOG, "%r", &x);
23: if ( lockexist(rmtname) )
24: lockrm(rmtname);
25: if ( lockttyexist(rdevname) ) {
26: if(role == MASTER){
27: dcpundial();
28: }else{
29: close(1); /* see comments for catchhup() */
30: close(2);
31: close(3);
32: }
33: if(unlocktty(rdevname) == -1){
34: printmsg(M_LOG,"fatal: could not remove lock file");
35: plog(M_CALL,"fatal: could not remove lock file");
36: }
37: }
38: close_logfile();
39: exec_xqt();
40: exit(1);
41: }
42:
43: catchhup()
44: {
45: plog(M_LOG, "Call terminated by hangup.");
46:
47: if ( lockexist(rmtname) ){
48: lockrm(rmtname);
49: }
50: if ( lockttyexist(rdevname) ) {
51: lockrm(rdevname);
52: }
53:
54: if(role==MASTER){
55: dcpundial();
56: }else{
57: /* if we're a slave, then our read and write
58: * devices are stdin & stdout. We're closing
59: * stderr also as a precaution
60: */
61: close(1);
62: close(2);
63: close(3);
64: }
65: exec_xqt();
66: exit(1);
67:
68: }
69:
70: catchquit()
71: {
72: fatal("Call terminated by quit signal");
73: }
74:
75: catchterm()
76: {
77: fatal("Call terminated by local signal");
78: }
79:
80: catchsegv()
81: {
82: fatal("Segmentation violation--Call aborted");
83: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.