Deleted Added
full compact
chat.c (23585) chat.c (23840)
1/*
2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3 *
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5 *
6 * Most of codes are derived from chat.c by Karl Fox (karl@MorningStar.Com).
7 *
8 * Chat -- a program for automatic session establishment (i.e. dial

--- 4 unchanged lines hidden (view full) ---

13 * Please send all bug reports, requests for information, etc. to:
14 *
15 * Karl Fox <karl@MorningStar.Com>
16 * Morning Star Technologies, Inc.
17 * 1760 Zollinger Road
18 * Columbus, OH 43221
19 * (614)451-1883
20 *
1/*
2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3 *
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5 *
6 * Most of codes are derived from chat.c by Karl Fox (karl@MorningStar.Com).
7 *
8 * Chat -- a program for automatic session establishment (i.e. dial

--- 4 unchanged lines hidden (view full) ---

13 * Please send all bug reports, requests for information, etc. to:
14 *
15 * Karl Fox <karl@MorningStar.Com>
16 * Morning Star Technologies, Inc.
17 * 1760 Zollinger Road
18 * Columbus, OH 43221
19 * (614)451-1883
20 *
21 * $Id: chat.c,v 1.20 1997/03/09 20:03:34 ache Exp $
21 * $Id: chat.c,v 1.21 1997/03/09 20:09:14 ache Exp $
22 *
23 * TODO:
24 * o Support more UUCP compatible control sequences.
25 * o Dialing shoud not block monitor process.
26 * o Reading modem by select should be unified into main.c
27 */
28#include "defs.h"
29#include <ctype.h>
30#include <sys/uio.h>
31#ifndef isblank
32#define isblank(c) ((c) == '\t' || (c) == ' ')
33#endif
34#include <sys/time.h>
35#include <fcntl.h>
36#include <errno.h>
37#include <signal.h>
38#include <sys/wait.h>
39#include "timeout.h"
40#include "vars.h"
22 *
23 * TODO:
24 * o Support more UUCP compatible control sequences.
25 * o Dialing shoud not block monitor process.
26 * o Reading modem by select should be unified into main.c
27 */
28#include "defs.h"
29#include <ctype.h>
30#include <sys/uio.h>
31#ifndef isblank
32#define isblank(c) ((c) == '\t' || (c) == ' ')
33#endif
34#include <sys/time.h>
35#include <fcntl.h>
36#include <errno.h>
37#include <signal.h>
38#include <sys/wait.h>
39#include "timeout.h"
40#include "vars.h"
41#include "sig.h"
41
42#define IBSIZE 200
43
44static int TimeoutSec;
45static int abort_next, timeout_next;
46static int numaborts;
47char *AbortStrings[50];
48char inbuff[IBSIZE*2+1];

--- 348 unchanged lines hidden (view full) ---

397 cp--;
398 }
399 snprintf(tmp, sizeof tmp, "%s %s", command, cp);
400 (void) MakeArgs(tmp, &vector);
401
402 pipe(fids);
403 pid = fork();
404 if (pid == 0) {
42
43#define IBSIZE 200
44
45static int TimeoutSec;
46static int abort_next, timeout_next;
47static int numaborts;
48char *AbortStrings[50];
49char inbuff[IBSIZE*2+1];

--- 348 unchanged lines hidden (view full) ---

398 cp--;
399 }
400 snprintf(tmp, sizeof tmp, "%s %s", command, cp);
401 (void) MakeArgs(tmp, &vector);
402
403 pipe(fids);
404 pid = fork();
405 if (pid == 0) {
406 TermTimerService();
405 signal(SIGINT, SIG_DFL);
406 signal(SIGQUIT, SIG_DFL);
407 signal(SIGTERM, SIG_DFL);
408 signal(SIGHUP, SIG_DFL);
407 signal(SIGINT, SIG_DFL);
408 signal(SIGQUIT, SIG_DFL);
409 signal(SIGTERM, SIG_DFL);
410 signal(SIGHUP, SIG_DFL);
411 signal(SIGALRM, SIG_DFL);
409 close(fids[0]);
410 dup2(fids[1], 1);
411 close(fids[1]);
412 nb = open("/dev/tty", O_RDWR);
413 dup2(nb, 0);
414 LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
415 /* switch back to original privileges */
416 if (setgid(getgid()) < 0) {

--- 173 unchanged lines hidden ---
412 close(fids[0]);
413 dup2(fids[1], 1);
414 close(fids[1]);
415 nb = open("/dev/tty", O_RDWR);
416 dup2(nb, 0);
417 LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
418 /* switch back to original privileges */
419 if (setgid(getgid()) < 0) {

--- 173 unchanged lines hidden ---