|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* functions.c This file contains the functions that talk to the modem
|
|
Packit |
15a96c |
* and the serial port. It seperates the user interface
|
|
Packit |
15a96c |
* from the low-level functions. The script language also
|
|
Packit |
15a96c |
* uses these functions.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This file is part of the minicom communications package,
|
|
Packit |
15a96c |
* Copyright 1991-1995 Miquel van Smoorenburg.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This program is free software; you can redistribute it and/or
|
|
Packit |
15a96c |
* modify it under the terms of the GNU General Public License
|
|
Packit |
15a96c |
* as published by the Free Software Foundation; either version
|
|
Packit |
15a96c |
* 2 of the License, or (at your option) any later version.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* You should have received a copy of the GNU General Public License along
|
|
Packit |
15a96c |
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
15a96c |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* // jl 23.06.97 adjustable DTR drop time
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#ifdef HAVE_CONFIG_H
|
|
Packit |
15a96c |
#include <config.h>
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#include "port.h"
|
|
Packit |
15a96c |
#include "minicom.h"
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Send a string to the modem.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
void m_puts(char *s)
|
|
Packit |
15a96c |
{
|
|
Packit |
15a96c |
char c;
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
while (*s) {
|
|
Packit |
15a96c |
if (*s == '^' && *(s + 1)) {
|
|
Packit |
15a96c |
s++;
|
|
Packit |
15a96c |
if (*s == '^')
|
|
Packit |
15a96c |
c = *s;
|
|
Packit |
15a96c |
else
|
|
Packit |
15a96c |
c = *s & 31;
|
|
Packit |
15a96c |
} else
|
|
Packit |
15a96c |
c = *s;
|
|
Packit |
15a96c |
if (c == '~')
|
|
Packit |
15a96c |
sleep(1);
|
|
Packit |
15a96c |
else
|
|
Packit |
15a96c |
write(portfd, &c, 1);
|
|
Packit |
15a96c |
s++;
|
|
Packit |
15a96c |
}
|
|
Packit |
15a96c |
}
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Hangup. */
|
|
Packit |
15a96c |
void m_hangup(void)
|
|
Packit |
15a96c |
{
|
|
Packit |
15a96c |
int sec = 1;
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
if (isdigit(P_MDROPDTR[0]))
|
|
Packit |
15a96c |
sscanf(P_MDROPDTR, "%2d", &sec);
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
if (P_MDROPDTR[0] == 'Y' || (isdigit(P_MDROPDTR[0]) && sec > 0)) {
|
|
Packit |
15a96c |
m_dtrtoggle(portfd, sec); /* jl 22.06.97 */
|
|
Packit |
15a96c |
} else {
|
|
Packit |
15a96c |
m_puts(P_MHANGUP);
|
|
Packit |
15a96c |
sleep(1);
|
|
Packit |
15a96c |
}
|
|
Packit |
15a96c |
/* If we don't have DCD support fake DCD dropped */
|
|
Packit |
15a96c |
bogus_dcd = 0;
|
|
Packit |
15a96c |
}
|
|
Packit |
15a96c |
|