*/
#ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.41 1997/04/30 05:54:52 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.43 1997/11/27 06:09:20 paulus Exp $";
#endif
#include <stdio.h>
int argc;
char *argv[];
{
- int i, nonblock, fdflags;
+ int i, fdflags;
struct sigaction sa;
FILE *pidfile;
char *p;
if (connector && connector[0]) {
MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector));
- /* set line speed, flow control, etc.; set CLOCAL for now */
+ /*
+ * Set line speed, flow control, etc.
+ * On most systems we set CLOCAL for now so that we can talk
+ * to the modem before carrier comes up. But this has the
+ * side effect that we might miss it if CD drops before we
+ * get to clear CLOCAL below. On systems where we can talk
+ * successfully to the modem with CLOCAL clear and CD down,
+ * we can clear CLOCAL at this point.
+ */
set_up_tty(ttyfd, 1);
/* drop dtr to hang up in case modem is off hook */
goto fail;
}
+
syslog(LOG_INFO, "Serial connection established.");
sleep(1); /* give it time to set up its terminal */
}
while ((i = open(devnam, O_RDWR)) < 0) {
if (errno != EINTR)
syslog(LOG_ERR, "Failed to reopen %s: %m", devnam);
- if (!persist || errno != EINTR)
+ if (!persist || errno != EINTR || hungup || kill_link)
goto fail;
}
close(i);
}
if (!persist)
- break;
+ die(1);
if (demand)
demand_discard();