acu.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ident "%Z%%M% %I% %E% SMI" /* from UCB 5.3 4/3/86 */
#include "tip.h"
static int conflag;
static void acuabort();
static sigjmp_buf jmpbuf;
/*
* Establish connection for tip
*
* If DU is true, we should dial an ACU whose type is AT.
* The phone numbers are in PN, and the call unit is in CU.
*
* If the PN is an '@', then we consult the PHONES file for
* by an exported shell variable.
*
* The data base files must be in the format:
* host-name[ \t]*phone-number
* with the possibility of multiple phone numbers
* for a single host acting as a rotary (in the order
* found in the file).
*/
char *
connect()
{
int tried = 0;
if (!DU)
return (NOSTR);
/*
* @ =>'s use data base in PHONES environment variable
*/
printf("\ncall aborted\n");
if (conflag)
else
}
myperm();
exit(1);
}
return ("unknown ACU type");
if (*cp != '@') {
while (*cp) {
;
if (*cp)
*cp++ = '\0';
"call completed");
return (NOSTR);
} else
"call failed");
tried++;
}
} else {
return ("can't open phone number file");
}
if (string[0] == '#')
continue;
;
if (*cp == '\n')
return ("unrecognizable host name");
*cp++ = '\0';
continue;
cp++;
if (*cp == '\n')
return ("missing phone number");
;
*cp = '\0';
"call completed");
return (NOSTR);
} else
"call failed");
tried++;
}
}
if (!tried)
else
}
char *reason;
{
if (!conflag)
return;
printf("\r\ndisconnecting...");
} else
(*acu->acu_disconnect)();
}
static void
acuabort(s)
{
}
static acu_t *
acutype(s)
register char *s;
{
register acu_t *p;
if (s != NOSTR)
return (p);
return (NOACU);
}