File:  [MW Coherent from dump] / coherent / a / usr / bob / uusrc / dcp / dcpmisc.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * dcpmisc.c
 *
 * Miscellaneous Support Routines for uucico
 */

#include "dcp.h"

usage()
{
	fatal("\n\
Usage:  uucico [-xn] [-r0]		slave mode\n\
	uucico [-xn] [-r1] -{sS}host 	call host\n\
	uucico [-xn] [-r1] -{sS}all	call all known hosts\n\
	uucico [-xn] [-r1] -{c}all	call known hosts only if files pending\n\
	uucico [-xn] -r1		call uutouch queued hosts\n\
");
}

fatal(x)
{
	printmsg(M_LOG, "%r", &x);
	if ( lockexist(rmtname) )
		lockrm(rmtname);
	if ( lockttyexist(rdevname) ) {
		if(role == MASTER){
			dcpundial();
		}else{
			close(1);  /* see comments for catchhup() */
			close(2);
			close(3);
		}
		if(unlocktty(rdevname) == -1){
			printmsg(M_LOG,"fatal: could not remove lock file");
			plog(M_CALL,"fatal: could not remove lock file");
		}
	}
	close_logfile();
	exit(1);
}

catchhup()
{
	plog(M_LOG, "Call terminated by hangup.");

	if ( lockexist(rmtname) ){
		lockrm(rmtname);
	}
	if ( lockttyexist(rdevname) ) {
		lockrm(rdevname);
	}

	if(role==MASTER){
		dcpundial();
	}else{
		/* if we're a slave, then our read and write
		 * devices are stdin & stdout. We're closing
		 * stderr also as a precaution
		 */
		close(1);
		close(2);
		close(3);
	}

	exit(1);

}

catchquit()
{
	fatal("Call terminated by quit signal");
}

catchterm()
{
	fatal("Call terminated by local signal");
}

catchsegv()
{
	fatal("Segmentation violation--Call aborted");
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.