|
|
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: exit(1);
40: }
41:
42: catchhup()
43: {
44: plog(M_LOG, "Call terminated by hangup.");
45:
46: if ( lockexist(rmtname) ){
47: lockrm(rmtname);
48: }
49: if ( lockttyexist(rdevname) ) {
50: lockrm(rdevname);
51: }
52:
53: if(role==MASTER){
54: dcpundial();
55: }else{
56: /* if we're a slave, then our read and write
57: * devices are stdin & stdout. We're closing
58: * stderr also as a precaution
59: */
60: close(1);
61: close(2);
62: close(3);
63: }
64:
65: exit(1);
66:
67: }
68:
69: catchquit()
70: {
71: fatal("Call terminated by quit signal");
72: }
73:
74: catchterm()
75: {
76: fatal("Call terminated by local signal");
77: }
78:
79: catchsegv()
80: {
81: fatal("Segmentation violation--Call aborted");
82: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.