hayes.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"
#include "tip.h"
static void sigALRM();
static sigjmp_buf timeoutbuf;
/*
* Dial up on a Hayes Smart Modem 1200 or 2400
*/
int
{
void (*f)();
if (!hayes_sync(FD)) {
printf("can't synchronize with hayes\n");
#ifdef ACULOG
#endif
return (0);
}
printf("\ndialing...");
#ifdef ACULOG
char line[80];
#endif
return (0);
}
if (*num == 'S')
else
alarm(0);
return (1);
return (0);
}
{
}
{
alarm(0);
sleep(2);
}
static void
sigALRM()
{
}
/*
* This piece of code attempts to get the hayes in sync.
*/
static int
{
register int tries;
/*
* Toggle DTR to force anyone off that might have left
* the modem connected, and insure a consistent state
* to start from.
*/
sleep(1);
/*
* After reseting the modem, initialize all
* parameters to required vaules:
*
* V0 - result codes are single digits
* Q0 - result codes ARE sent
* E0 - do not echo
* S0=1 - automatically answer phone
* S2=255 - disable escape character
* S12=255 - longest possible escape guard time
*/
sleep(1);
/* flush any echoes or return codes */
/* now see if the modem is talking to us properly */
alarm(2);
return (1);
}
}
return (0);
}