biz22.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
/* from UCB 4.4 6/25/83 */
/*
* 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 void sigALRM();
static int timeout = 0;
static sigjmp_buf timeoutbuf;
/*
* Dial up on a BIZCOMP Model 1022 with either
* tone dialing (mod = "V")
* pulse dialing (mod = "W")
*/
static int
{
register int connected = 0;
char cbuf[40];
printf("\nstarting call...");
/*
* dialing
*/
if (cmd("\02K\r")) {
printf("can't initialize bizcomp...");
return (0);
}
printf("can't set dialing mode...");
return (0);
}
if (!detect("7\r")) {
printf("can't get dial tone...");
return (0);
}
printf("ringing...");
/*
* The reply from the BIZCOMP should be:
* 2 \r or 7 \r failure
* 1 \r success
*/
#ifdef ACULOG
if (timeout) {
char line[80];
}
#endif
if (timeout)
biz22_disconnect(); /* insurance */
return (connected);
}
{
}
{
}
{
sleep(2);
}
{
}
static void
sigALRM()
{
timeout = 1;
}
static int
cmd(s)
register char *s;
{
char c;
biz22_abort();
return (1);
}
alarm(0);
c &= 0177;
return (c != '\r');
}
static int
detect(s)
register char *s;
{
char c;
timeout = 0;
while (*s) {
biz22_abort();
break;
}
alarm(0);
c &= 0177;
if (c != *s++)
return (0);
}
return (timeout == 0);
}