/*
* Copyright 2000 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 void sigALRM(void);
static int cmd(char *);
static int detect(char *);
static int timeout = 0;
void biz22_disconnect(void);
/*
* Dial up on a BIZCOMP Model 1022 with either
* tone dialing (mod = "V")
* pulse dialing (mod = "W")
*/
static int
{
int connected = 0;
(void) printf("\nstarting call...");
/*
* dialing
*/
if (cmd("\02K\r")) {
(void) printf("can't initialize bizcomp...");
return (0);
}
(void) printf("can't set dialing mode...");
return (0);
}
if (!detect("7\r")) {
(void) printf("can't get dial tone...");
return (0);
}
(void) printf("ringing...");
/*
* The reply from the BIZCOMP should be:
* 2 \r or 7 \r failure
* 1 \r success
*/
#ifdef ACULOG
if (timeout) {
}
#endif
if (timeout)
biz22_disconnect(); /* insurance */
return (connected);
}
/* ARGSUSED */
int
{
}
/* ARGSUSED */
int
{
}
void
biz22_disconnect(void)
{
(void) sleep(2);
}
void
biz22_abort(void)
{
}
static void
sigALRM(void)
{
timeout = 1;
}
static int
cmd(char *s)
{
char c;
biz22_abort();
return (1);
}
(void) alarm(0);
c &= 0177;
return (c != '\r');
}
static int
detect(char *s)
{
char c;
timeout = 0;
while (*s) {
biz22_abort();
break;
}
(void) alarm(0);
c &= 0177;
if (c != *s++)
return (0);
}
return (timeout == 0);
}