/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "tip.h"
static int conflag;
static void acuabort(int);
/*
* 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(void)
{
int tried = 0;
if (!DU)
return (NOSTR);
/*
* @ =>'s use data base in PHONES environment variable
*/
(void) 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
}
void
{
if (!conflag)
return;
(void) printf("\r\ndisconnecting...");
} else
(*acu->acu_disconnect)();
}
static void
acuabort(int s)
{
}
static acu_t *
acutype(char *s)
{
acu_t *p;
if (s != NOSTR)
return (p);
return (NOACU);
}