head 1.12; access; symbols pkgsrc-2026Q1:1.12.0.114 pkgsrc-2026Q1-base:1.12 pkgsrc-2025Q4:1.12.0.112 pkgsrc-2025Q4-base:1.12 pkgsrc-2025Q3:1.12.0.110 pkgsrc-2025Q3-base:1.12 pkgsrc-2025Q2:1.12.0.108 pkgsrc-2025Q2-base:1.12 pkgsrc-2025Q1:1.12.0.106 pkgsrc-2025Q1-base:1.12 pkgsrc-2024Q4:1.12.0.104 pkgsrc-2024Q4-base:1.12 pkgsrc-2024Q3:1.12.0.102 pkgsrc-2024Q3-base:1.12 pkgsrc-2024Q2:1.12.0.100 pkgsrc-2024Q2-base:1.12 pkgsrc-2024Q1:1.12.0.98 pkgsrc-2024Q1-base:1.12 pkgsrc-2023Q4:1.12.0.96 pkgsrc-2023Q4-base:1.12 pkgsrc-2023Q3:1.12.0.94 pkgsrc-2023Q3-base:1.12 pkgsrc-2023Q2:1.12.0.92 pkgsrc-2023Q2-base:1.12 pkgsrc-2023Q1:1.12.0.90 pkgsrc-2023Q1-base:1.12 pkgsrc-2022Q4:1.12.0.88 pkgsrc-2022Q4-base:1.12 pkgsrc-2022Q3:1.12.0.86 pkgsrc-2022Q3-base:1.12 pkgsrc-2022Q2:1.12.0.84 pkgsrc-2022Q2-base:1.12 pkgsrc-2022Q1:1.12.0.82 pkgsrc-2022Q1-base:1.12 pkgsrc-2021Q4:1.12.0.80 pkgsrc-2021Q4-base:1.12 pkgsrc-2021Q3:1.12.0.78 pkgsrc-2021Q3-base:1.12 pkgsrc-2021Q2:1.12.0.76 pkgsrc-2021Q2-base:1.12 pkgsrc-2021Q1:1.12.0.74 pkgsrc-2021Q1-base:1.12 pkgsrc-2020Q4:1.12.0.72 pkgsrc-2020Q4-base:1.12 pkgsrc-2020Q3:1.12.0.70 pkgsrc-2020Q3-base:1.12 pkgsrc-2020Q2:1.12.0.66 pkgsrc-2020Q2-base:1.12 pkgsrc-2020Q1:1.12.0.46 pkgsrc-2020Q1-base:1.12 pkgsrc-2019Q4:1.12.0.68 pkgsrc-2019Q4-base:1.12 pkgsrc-2019Q3:1.12.0.64 pkgsrc-2019Q3-base:1.12 pkgsrc-2019Q2:1.12.0.62 pkgsrc-2019Q2-base:1.12 pkgsrc-2019Q1:1.12.0.60 pkgsrc-2019Q1-base:1.12 pkgsrc-2018Q4:1.12.0.58 pkgsrc-2018Q4-base:1.12 pkgsrc-2018Q3:1.12.0.56 pkgsrc-2018Q3-base:1.12 pkgsrc-2018Q2:1.12.0.54 pkgsrc-2018Q2-base:1.12 pkgsrc-2018Q1:1.12.0.52 pkgsrc-2018Q1-base:1.12 pkgsrc-2017Q4:1.12.0.50 pkgsrc-2017Q4-base:1.12 pkgsrc-2017Q3:1.12.0.48 pkgsrc-2017Q3-base:1.12 pkgsrc-2017Q2:1.12.0.44 pkgsrc-2017Q2-base:1.12 pkgsrc-2017Q1:1.12.0.42 pkgsrc-2017Q1-base:1.12 pkgsrc-2016Q4:1.12.0.40 pkgsrc-2016Q4-base:1.12 pkgsrc-2016Q3:1.12.0.38 pkgsrc-2016Q3-base:1.12 pkgsrc-2016Q2:1.12.0.36 pkgsrc-2016Q2-base:1.12 pkgsrc-2016Q1:1.12.0.34 pkgsrc-2016Q1-base:1.12 pkgsrc-2015Q4:1.12.0.32 pkgsrc-2015Q4-base:1.12 pkgsrc-2015Q3:1.12.0.30 pkgsrc-2015Q3-base:1.12 pkgsrc-2015Q2:1.12.0.28 pkgsrc-2015Q2-base:1.12 pkgsrc-2015Q1:1.12.0.26 pkgsrc-2015Q1-base:1.12 pkgsrc-2014Q4:1.12.0.24 pkgsrc-2014Q4-base:1.12 pkgsrc-2014Q3:1.12.0.22 pkgsrc-2014Q3-base:1.12 pkgsrc-2014Q2:1.12.0.20 pkgsrc-2014Q2-base:1.12 pkgsrc-2014Q1:1.12.0.18 pkgsrc-2014Q1-base:1.12 pkgsrc-2013Q4:1.12.0.16 pkgsrc-2013Q4-base:1.12 pkgsrc-2013Q3:1.12.0.14 pkgsrc-2013Q3-base:1.12 pkgsrc-2013Q2:1.12.0.12 pkgsrc-2013Q2-base:1.12 pkgsrc-2013Q1:1.12.0.10 pkgsrc-2013Q1-base:1.12 pkgsrc-2012Q4:1.12.0.8 pkgsrc-2012Q4-base:1.12 pkgsrc-2012Q3:1.12.0.6 pkgsrc-2012Q3-base:1.12 pkgsrc-2012Q2:1.12.0.4 pkgsrc-2012Q2-base:1.12 pkgsrc-2012Q1:1.12.0.2 pkgsrc-2012Q1-base:1.12 pkgsrc-2011Q4:1.10.0.4 pkgsrc-2011Q4-base:1.10 pkgsrc-2011Q3:1.10.0.2 pkgsrc-2011Q3-base:1.10 pkgsrc-2011Q2:1.9.0.48 pkgsrc-2011Q2-base:1.9 pkgsrc-2011Q1:1.9.0.46 pkgsrc-2011Q1-base:1.9 pkgsrc-2010Q4:1.9.0.44 pkgsrc-2010Q4-base:1.9 pkgsrc-2010Q3:1.9.0.42 pkgsrc-2010Q3-base:1.9 pkgsrc-2010Q2:1.9.0.40 pkgsrc-2010Q2-base:1.9 pkgsrc-2010Q1:1.9.0.38 pkgsrc-2010Q1-base:1.9 pkgsrc-2009Q4:1.9.0.36 pkgsrc-2009Q4-base:1.9 pkgsrc-2009Q3:1.9.0.34 pkgsrc-2009Q3-base:1.9 pkgsrc-2009Q2:1.9.0.32 pkgsrc-2009Q2-base:1.9 pkgsrc-2009Q1:1.9.0.30 pkgsrc-2009Q1-base:1.9 pkgsrc-2008Q4:1.9.0.28 pkgsrc-2008Q4-base:1.9 pkgsrc-2008Q3:1.9.0.26 pkgsrc-2008Q3-base:1.9 cube-native-xorg:1.9.0.24 cube-native-xorg-base:1.9 pkgsrc-2008Q2:1.9.0.22 pkgsrc-2008Q2-base:1.9 cwrapper:1.9.0.20 pkgsrc-2008Q1:1.9.0.18 pkgsrc-2008Q1-base:1.9 pkgsrc-2007Q4:1.9.0.16 pkgsrc-2007Q4-base:1.9 pkgsrc-2007Q3:1.9.0.14 pkgsrc-2007Q3-base:1.9 pkgsrc-2007Q2:1.9.0.12 pkgsrc-2007Q2-base:1.9 pkgsrc-2007Q1:1.9.0.10 pkgsrc-2007Q1-base:1.9 pkgsrc-2006Q4:1.9.0.8 pkgsrc-2006Q4-base:1.9 pkgsrc-2006Q3:1.9.0.6 pkgsrc-2006Q3-base:1.9 pkgsrc-2006Q2:1.9.0.4 pkgsrc-2006Q2-base:1.9 pkgsrc-2006Q1:1.9.0.2 pkgsrc-2006Q1-base:1.9 pkgsrc-2005Q4:1.6.0.2 pkgsrc-2005Q4-base:1.6 pkgsrc-2005Q3:1.5.0.2 pkgsrc-2005Q3-base:1.5 pkgsrc-2005Q2:1.3.0.14 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.12 pkgsrc-2005Q1-base:1.3 pkgsrc-2004Q4:1.3.0.10 pkgsrc-2004Q4-base:1.3 pkgsrc-2004Q3:1.3.0.8 pkgsrc-2004Q3-base:1.3 pkgsrc-2004Q2:1.3.0.6 pkgsrc-2004Q2-base:1.3 pkgsrc-2004Q1:1.3.0.4 pkgsrc-2004Q1-base:1.3 pkgsrc-2003Q4:1.3.0.2 pkgsrc-2003Q4-base:1.3 netbsd-1-6-1:1.1.0.6 netbsd-1-6-1-base:1.1 netbsd-1-6:1.1.0.8 netbsd-1-6-RELEASE-base:1.1 pkgviews:1.1.0.4 pkgviews-base:1.1 buildlink2:1.1.0.2 buildlink2-base:1.1 netbsd-1-5-PATCH003:1.1 netbsd-1-5-PATCH001:1.1 netbsd-1-5-RELEASE:1.1 netbsd-1-4-PATCH003:1.1 netbsd-1-4-PATCH002:1.1; locks; strict; comment @# @; 1.12 date 2012.03.05.12.16.00; author obache; state Exp; branches; next 1.11; 1.11 date 2012.03.01.22.00.44; author hans; state Exp; branches; next 1.10; 1.10 date 2011.09.29.20.22.26; author wiz; state Exp; branches; next 1.9; 1.9 date 2006.01.17.21.23.01; author kristerw; state Exp; branches; next 1.8; 1.8 date 2006.01.03.19.28.00; author joerg; state Exp; branches; next 1.7; 1.7 date 2006.01.03.18.16.10; author joerg; state Exp; branches; next 1.6; 1.6 date 2005.12.10.22.10.47; author christos; state Exp; branches; next 1.5; 1.5 date 2005.09.13.19.40.59; author christos; state Exp; branches; next 1.4; 1.4 date 2005.09.13.19.25.57; author christos; state Exp; branches; next 1.3; 1.3 date 2003.11.11.10.42.32; author wiz; state Exp; branches; next 1.2; 1.2 date 2003.11.07.16.35.51; author christos; state Exp; branches; next 1.1; 1.1 date 2000.02.07.03.18.13; author christos; state Exp; branches; next ; desc @@ 1.12 log @Remove RCS tags from patches. @ text @$NetBSD: patch-aj,v 1.11 2012/03/01 22:00:44 hans Exp $ --- fep_main.c.orig 1993-06-10 02:53:06.000000000 +0000 +++ fep_main.c 2011-09-29 20:16:05.000000000 +0000 @@@@ -6,15 +6,27 @@@@ -#endif lint +#endif /* lint */ #include #include #include #include #include -#include +#ifdef TERMIOS +#include +#include +#include +#ifdef __sun +#include +#endif +#ifndef _POSIX_VDISABLE +#define _POSIX_VDISABLE '\0' +#endif +#else #include +#include +#endif #include #include -#include +#include #include "fep_defs.h" #include "fep_glob.h" @@@@ -30,7 +42,7 @@@@ static char rcsid[]= #ifdef STAT static char fep_statrc[] = FEP_STAT; #endif -#endif lint +#endif /* lint */ char *myself; /* the command name */ char *prompt = ""; /* prompt string */ @@@@ -38,9 +50,9 @@@@ char *delimiters = DEFAULT_DELIMITERS; /* delimiter characters */ int master; /* file discriptor for pty master */ int slave; /* file discriptor for pty slave */ -int mastermask; /* 1<_cnt) - if (CHAR_IN_BUFFER) - goto RETURNCHAR; + FD_ZERO(&writefd); + FD_ZERO(&exceptfd); RETRY: readfd = selectmask; @@@@ -409,13 +430,13 @@@@ RETRY: while ((nfound = select (selectnfds, &readfd, 0, 0, *timeout)) < 0) if (errno != EINTR) { perror ("select"); - terminate(); + terminate(1); } /* * Found output from pty. */ - if (readfd & mastermask) { + if (FD_ISSET(master, &readfd)) { int nbyte; /* @@@@ -451,7 +472,7 @@@@ RETRY: /* * Found input from terminal */ - if (CHAR_IN_BUFFER || readfd & stdinmask) { + if (FD_ISSET(fileno(stdin), &readfd)) { #ifndef USE_TIMEOUT /* @@@@ -467,8 +488,8 @@@@ RETRY: RETURNCHAR: if ((c = getc (stdin)) == EOF) { if (debug) - printf ("EOF chatched\n"); - terminate (); + printf ("EOF catched\n"); + terminate (1); } else return (c & CHARMASK); @@@@ -504,7 +525,7 @@@@ int set_buffer (bp, size) BUFFER *bp; int size; { - char *newbuf, *malloc(), *realloc(); + char *newbuf; if (bp->b_buf) newbuf = (char *) realloc (bp->b_buf, size); @@@@ -596,7 +617,7 @@@@ buf_put (bp, s) swallow_output() { - int readfd = mastermask; + fd_set readfd = mastermask; int r; int nbyte; int ncount = 10; @@@@ -604,7 +625,7 @@@@ swallow_output() while ( ncount-- && select (selectnfds, &readfd, 0, 0, TIMEOUT_NOBLOCK) > 0 && - readfd & mastermask + FD_ISSET(master, &mastermask) ) { nbyte = buf_read (master, output_buffer); if (nbyte > 0) { @@@@ -636,21 +657,23 @@@@ swallow_output() #include #endif -catchsig() +void +catchsig(n) + int n; { - union wait status; + int status; struct rusage ru; if (wait3 (&status, WNOHANG | WUNTRACED, &ru) != child_pid) return; if (WIFSTOPPED (status) /* || WIFSIGNALED (status) */) { if (debug) { - message ("Child has sttoped!!\n"); + message ("Child has stopped!!\n"); } suspend (); return; } - terminate (); + terminate (WEXITSTATUS(status)); } exec_to_command(argv) @@@@ -675,13 +698,37 @@@@ exec_to_command(argv) dup2 (slave, 2); (void) close (slave); +#ifdef TERMIOS + tcsetattr(0, TCSANOW, &slave_ttymode); +#elif defined(TIOCSETN) ioctl (0, TIOCSETN, (char *) & slave_ttymode); - +#endif execvp (*argv, argv, 0); perror (*argv); exit (1); } +#ifdef TERMIOS +fix_tty() +{ + int i; + master_ttymode = initial_ttymode; + slave_ttymode = initial_ttymode; + master_ttymode.c_lflag &= ~(ECHO|ECHOE|ECHOK|ICANON); + + for (i = 0; i < NCCS; i++) + master_ttymode.c_cc[i] = _POSIX_VDISABLE; + + master_ttymode.c_cc[VMIN] = 1; + master_ttymode.c_cc[VTIME] = 0; + slave_ttymode.c_lflag &= ~(ECHO|ECHOE|ECHOK); + slave_ttymode.c_iflag &= ~(ICRNL); + slave_ttymode.c_oflag &= ~(ONLCR); + tcsetattr(0, TCSANOW, &master_ttymode); +} + +#elif defined(TIOCSETN) + fix_tty() { struct tchars tcbuf; @@@@ -719,6 +766,7 @@@@ fix_tty() ioctl (0, TIOCSETC, (char *) & tcbuf); ioctl (0, TIOCSLTC, (char *) & lcbuf); } +#endif kill_process() { @@@@ -727,9 +775,10 @@@@ kill_process() (void) killpg (child_pid, SIGTERM); } -terminate() +void +terminate(n) + int n; { - extern int errno; /* * Save history if 'history-file' is set @@@@ -759,10 +808,14 @@@@ terminate() if (killpg (child_pid, SIGKILL) < 0) perror ("kill"); +#ifdef TERMIOS + tcsetattr(0, TCSANOW, &initial_ttymode); +#elif defined(TIOCSETN) ioctl (0, TIOCSETN, (char *) & initial_ttymode); ioctl (0, TIOCSETC, (char *) & tchars_buf); ioctl (0, TIOCSLTC, (char *) & ltchars_buf); - exit (0); +#endif + exit (n); } get_pty_master() @@@@ -775,6 +828,41 @@@@ get_pty_master() master = 1; return; } +#ifdef HAVE_PTMX + if ((master = open("/dev/ptmx", O_RDWR)) == -1) { + perror ("Couldn't open pseudo tty"); + kill_process (); + exit (1); + } + if (grantpt (master) == -1) { + perror ("grantpt"); + kill_process (); + exit (1); + } + if (unlockpt (master) == -1) { + perror ("grantpt"); + kill_process (); + exit (1); + } + { +#ifdef __linux__ + if (ptsname_r (master, slave_tty, sizeof(slave_tty)) == -1) { + perror ("ptsname_r"); + kill_process (); + exit (1); + } +#else + char *ptr; + if ((ptr = ptsname (master)) == NULL) { + perror ("ptsname"); + kill_process (); + exit (1); + } + (void)strncpy (slave_tty, ptr, sizeof(slave_tty)); + slave_tty[sizeof(slave_tty) - 1] = '\0'; +#endif + } +#else for (c = 'p'; c <= 's'; c++) { for (i = 0; i < 16; i++) { sprintf (master_tty, "/dev/pty%c%x", c, i); @@@@ -796,11 +884,16 @@@@ get_pty_master() } FOUND: +#endif +#ifdef TERMIOS + tcgetattr(0, &initial_ttymode); +#elif defined(TIOCSETN) ioctl (0, TIOCGETP, (char *) &initial_ttymode); ioctl (0, TIOCGETC, (char *) &tchars_buf); ioctl (0, TIOCGETD, (char *) &line_desc); ioctl (0, TIOCGLTC, (char *) <chars_buf); ioctl (0, TIOCLGET, (char *) &lmode_buf); +#endif #ifdef TIOCGWINSZ { @@@@ -820,11 +913,15 @@@@ get_pty_master() # if defined(TIOCKGETC) && defined(TIOCKSETC) ioctl (0, TIOCKGETC, (char *) &jtchars_buf); # endif -#endif KANJI +#endif /* KANJI */ - stdinmask = 1 << fileno (stdin); - mastermask = 1 << master; - selectmask = stdinmask | mastermask; + FD_ZERO(&stdinmask); + FD_ZERO(&mastermask); + FD_ZERO(&selectmask); + FD_SET(fileno(stdin), &stdinmask); + FD_SET(master, &mastermask); + FD_SET(fileno(stdin), &selectmask); + FD_SET(master, &selectmask); selectnfds = max (fileno(stdin), master) + 1; return; @@@@ -838,11 +935,20 @@@@ get_pty_slave() perror (slave_tty); exit (1); } + if (setsid() == -1) + perror ("setsid"); + if (ioctl (slave, TIOCSCTTY, 1) == -1) + perror ("ioctl"); + +#ifdef TERMIOS + tcsetattr(slave, TCSANOW, &initial_ttymode); +#elif defined(TIOCSETN) ioctl (slave, TIOCSETN, (char *) &initial_ttymode); ioctl (slave, TIOCSETC, (char *) &tchars_buf); ioctl (slave, TIOCSLTC, (char *) <chars_buf); ioctl (slave, TIOCLSET, (char *) &lmode_buf); ioctl (slave, TIOCSETD, (char *) &line_desc); +#endif #ifdef KANJI # if defined(TIOCKGET) && defined(TIOCKSET) @@@@ -851,7 +957,7 @@@@ get_pty_slave() # if defined(TIOCKGETC) && defined(TIOCKSETC) ioctl (slave, TIOCKSETC, (char *) &jtchars_buf); # endif -#endif KANJI +#endif /* KANJI */ #ifdef TIOCSWINSZ { @@@@ -866,37 +972,40 @@@@ get_pty_slave() recover_tty() { - +#ifdef TERMIOS + tcsetattr(0, TCSANOW, &initial_ttymode); +#elif defined(TIOCSETN) ioctl (0, TIOCSETN, (char *) & initial_ttymode); ioctl (0, TIOCSETC, (char *) & tchars_buf); ioctl (0, TIOCSLTC, (char *) & ltchars_buf); +#endif } suspend() { long pid; - void (*func) (); - int omask; - extern int errno; + void (*func) (int); + sigset_t set, oset; pid = getpid (); /* reset signal handler so kill below stops us */ func = signal (SIGCHLD, SIG_IGN); signal (SIGTSTP, SIG_DFL); recover_tty(); -#define mask(s) (1 << ((s)-1)) - omask = sigsetmask (sigblock (0) & ~mask (SIGTSTP)); + sigemptyset(&set); + sigaddset(&set, SIGTSTP); + sigprocmask (SIG_BLOCK, &set, &oset); kill (0, SIGTSTP); if (kill (child_pid, SIGCONT) < 0 && errno == ESRCH) { printf ("Where my child has gone?!\n"); - terminate (); + terminate (1); } killpg (child_pid, SIGCONT); kill (0, SIGCONT); signal (SIGCHLD, func); signal (SIGTSTP, SIG_IGN); - sigblock (mask (SIGTSTP)); + sigprocmask (SIG_BLOCK, &set, &oset); fix_tty (); if (look_var ("auto-repaint")) fep_repaint(0); @@@@ -933,7 +1042,7 @@@@ usageAndExit() /* * Propagate window size changes to the slave tty. */ -sigwinch() +void sigwinch(int num) { #ifdef TIOCGWINSZ /* 4.3BSD */ struct winsize win; @ 1.11 log @Fix build on SunOS. - no more __P, just use ansi prototypes - use sigprocmask instead of sigsetmask - use dirent.h instead of sys/dir.h @ text @d1 1 a1 1 $NetBSD: patch-aj,v 1.10 2011/09/29 20:22:26 wiz Exp $ d5 1 a5 4 @@@@ -3,18 +3,30 @@@@ #ifndef lint static char rcsid[]= "$Id: fep_main.c,v 4.11 1993/06/10 02:51:28 utashiro Exp $ (SRA)"; @ 1.10 log @Fix build on NetBSD-current (getline). @ text @d1 1 a1 1 $NetBSD$ d5 4 a8 1 @@@@ -6,15 +6,24 @@@@ d22 3 d39 1 a39 1 @@@@ -30,7 +39,7 @@@@ d48 1 a48 1 @@@@ -38,9 +47,9 @@@@ d61 1 a61 1 @@@@ -48,27 +57,34 @@@@ d66 1 a66 1 +void catchsig __P((int)); /* function take care SIGCHILD */ d85 1 a85 1 +void (*sighup) __P((int)), (*sigchld) __P((int)), (*sigtstp) __P((int)); d102 1 a102 1 @@@@ -112,6 +128,10 @@@@ d113 1 a113 1 @@@@ -172,7 +192,7 @@@@ d122 1 a122 1 @@@@ -276,7 +296,7 @@@@ d127 1 a127 1 + void sigwinch __P((int)); d131 1 a131 1 @@@@ -298,7 +318,7 @@@@ d140 1 a140 1 @@@@ -306,7 +326,7 @@@@ d149 1 a149 1 @@@@ -322,7 +342,7 @@@@ d158 1 a158 1 @@@@ -336,7 +356,7 @@@@ d167 1 a167 1 @@@@ -384,21 +404,19 @@@@ d193 1 a193 1 @@@@ -409,13 +427,13 @@@@ d209 1 a209 1 @@@@ -451,7 +469,7 @@@@ d218 1 a218 1 @@@@ -467,8 +485,8 @@@@ d229 1 a229 1 @@@@ -504,7 +522,7 @@@@ d238 1 a238 1 @@@@ -596,7 +614,7 @@@@ d247 1 a247 1 @@@@ -604,7 +622,7 @@@@ d256 1 a256 1 @@@@ -636,21 +654,23 @@@@ d284 1 a284 1 @@@@ -675,13 +695,37 @@@@ d323 1 a323 1 @@@@ -719,6 +763,7 @@@@ d331 1 a331 1 @@@@ -727,9 +772,10 @@@@ d344 1 a344 1 @@@@ -759,10 +805,14 @@@@ d360 1 a360 1 @@@@ -775,6 +825,41 @@@@ d402 1 a402 1 @@@@ -796,11 +881,16 @@@@ d419 1 a419 1 @@@@ -820,11 +910,15 @@@@ d439 1 a439 1 @@@@ -838,11 +932,20 @@@@ d460 1 a460 1 @@@@ -851,7 +954,7 @@@@ d469 1 a469 1 @@@@ -866,18 +969,20 @@@@ d487 1 a487 2 + void (*func) __P((int)); int omask; d489 2 d494 9 a502 1 @@@@ -890,7 +995,7 @@@@ d511 8 a518 1 @@@@ -933,7 +1038,7 @@@@ d523 1 a523 1 +sigwinch(int num) @ 1.9 log @Regenerate hand edited patches so that they can be applied using the OS X patch program. @ text @d1 1 a1 1 $NetBSD: patch-aj,v 1.8 2006/01/03 19:28:00 joerg Exp $ d4 2 a5 2 +++ fep_main.c 2006-01-03 18:13:49.000000000 +0000 @@@@ -6 +6 @@@@ d8 3 a10 1 @@@@ -10,11 +10,20 @@@@ d33 1 a33 1 @@@@ -30,7 +39,7 @@@@ static char rcsid[]= d42 1 a42 1 @@@@ -38,9 +47,9 @@@@ char *delimiters = DEFAULT_DELIMITERS; d55 1 a55 1 @@@@ -48,27 +57,34 @@@@ int histlen = -1; /* history length */ d96 1 a96 1 @@@@ -112,6 +128,10 @@@@ main(argc, argv) d107 1 a107 1 @@@@ -172,7 +192,7 @@@@ main(argc, argv) d116 1 a116 1 @@@@ -276,7 +296,7 @@@@ DEFAULT: d125 28 a152 1 @@@@ -336,7 +356,7 @@@@ input_handler() d161 1 a161 1 @@@@ -384,21 +404,19 @@@@ getcharacter() d187 1 a187 1 @@@@ -409,13 +427,13 @@@@ RETRY: d203 1 a203 1 @@@@ -451,7 +469,7 @@@@ RETRY: d212 1 a212 1 @@@@ -467,8 +485,8 @@@@ RETRY: d223 1 a223 1 @@@@ -504,7 +522,7 @@@@ int set_buffer (bp, size) d232 1 a232 1 @@@@ -596,7 +614,7 @@@@ buf_put (bp, s) d241 1 a241 1 @@@@ -604,7 +622,7 @@@@ swallow_output() d250 1 a250 1 @@@@ -636,21 +654,23 @@@@ swallow_output() d278 1 a278 1 @@@@ -675,13 +695,37 @@@@ exec_to_command(argv) d317 1 a317 1 @@@@ -719,6 +763,7 @@@@ fix_tty() d325 1 a325 1 @@@@ -727,9 +772,10 @@@@ kill_process() d338 1 a338 1 @@@@ -759,10 +805,14 @@@@ terminate() d354 1 a354 1 @@@@ -775,6 +825,41 @@@@ get_pty_master() d396 1 a396 1 @@@@ -796,11 +881,16 @@@@ get_pty_master() d413 1 a413 1 @@@@ -820,11 +910,15 @@@@ get_pty_master() d433 1 a433 1 @@@@ -838,11 +932,20 @@@@ get_pty_slave() d454 1 a454 1 @@@@ -851,7 +954,7 @@@@ get_pty_slave() d463 1 a463 1 @@@@ -866,18 +969,20 @@@@ get_pty_slave() d487 1 a487 1 @@@@ -890,7 +995,7 @@@@ suspend() d496 1 a496 1 @@@@ -933,7 +1038,7 @@@@ usageAndExit() @ 1.8 log @Readd $NetBSD$ @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 @@@@ -6,15 +6,24 @@@@ d8 1 a8 3 #include #include @ 1.7 log @Fix patches: $Header$ is a CVS keyword. Remove realloc and malloc prototypes, they conflict with DragonFly's stdlib.h. Add parameter to sigwinch, it should match the local prototype. Fix errno. @ text @d1 2 @ 1.6 log @make it work on 64 bit machines @ text @d1 3 a3 8 $NetBSD$ --- fep_main.c.orig 1993-06-09 22:53:06.000000000 -0400 +++ fep_main.c 2005-12-10 16:59:27.000000000 -0500 @@@@ -3,15 +3,24 @@@@ #ifndef lint static char rcsid[]= "$Id: fep_main.c,v 4.11 1993/06/10 02:51:28 utashiro Exp $ (SRA)"; d26 6 a31 2 #include @@@@ -30,7 +39,7 @@@@ d40 1 a40 1 @@@@ -38,9 +47,9 @@@@ d53 1 a53 1 @@@@ -48,27 +57,34 @@@@ d94 1 a94 1 @@@@ -112,6 +128,10 @@@@ d105 1 a105 1 @@@@ -172,7 +192,7 @@@@ d114 1 a114 1 @@@@ -276,7 +296,7 @@@@ d123 1 a123 1 @@@@ -336,7 +356,7 @@@@ d132 1 a132 1 @@@@ -384,7 +404,8 @@@@ d142 5 a146 1 @@@@ -396,9 +417,8 @@@@ d158 1 a158 1 @@@@ -409,13 +429,13 @@@@ d174 1 a174 1 @@@@ -451,7 +471,7 @@@@ d183 1 a183 1 @@@@ -467,8 +487,8 @@@@ d194 10 a203 1 @@@@ -596,7 +616,7 @@@@ d212 1 a212 1 @@@@ -604,7 +624,7 @@@@ d221 1 a221 1 @@@@ -636,21 +656,23 @@@@ d249 1 a249 1 @@@@ -675,13 +697,37 @@@@ d288 1 a288 1 @@@@ -719,6 +765,7 @@@@ d296 1 a296 1 @@@@ -727,7 +774,9 @@@@ d305 1 a305 1 extern int errno; d307 3 a309 1 @@@@ -759,10 +808,14 @@@@ d325 1 a325 1 @@@@ -775,6 +828,41 @@@@ d367 1 a367 1 @@@@ -796,11 +884,16 @@@@ d384 1 a384 1 @@@@ -820,11 +913,15 @@@@ d404 1 a404 1 @@@@ -838,11 +935,20 @@@@ d425 1 a425 1 @@@@ -851,7 +957,7 @@@@ d434 1 a434 1 @@@@ -866,16 +972,19 @@@@ d454 1 a454 1 extern int errno; d456 3 a458 1 @@@@ -890,7 +999,7 @@@@ d467 9 @ 1.5 log @use -u0 to make this patch to avoid $Id$ from being expanded. @ text @d4 5 a8 2 +++ fep_main.c 2005-09-13 15:38:02.000000000 -0400 @@@@ -6 +6 @@@@ d11 6 a16 1 @@@@ -13 +13,8 @@@@ d26 1 a26 1 @@@@ -14,0 +22,2 @@@@ d29 7 a35 1 @@@@ -33 +42 @@@@ d38 7 a44 1 @@@@ -41,3 +50,3 @@@@ d51 7 a57 1 @@@@ -51 +60 @@@@ d60 1 a60 1 @@@@ -53,3 +62,8 @@@@ d72 5 a76 1 @@@@ -61 +75 @@@@ d79 2 a80 1 @@@@ -63,0 +78 @@@@ d82 2 a83 1 @@@@ -65,0 +81 @@@@ d85 5 a89 1 @@@@ -71 +87 @@@@ d92 7 a98 1 @@@@ -114,0 +131,4 @@@@ d103 7 a109 1 @@@@ -175 +195 @@@@ d112 7 a118 1 @@@@ -279 +299 @@@@ d121 7 a127 1 @@@@ -339 +359 @@@@ d130 7 a136 1 @@@@ -387 +407,2 @@@@ d140 7 a146 1 @@@@ -399,3 +420,2 @@@@ d152 7 a158 1 @@@@ -412 +432 @@@@ d161 5 a165 1 @@@@ -418 +438 @@@@ d168 7 a174 1 @@@@ -454 +474 @@@@ d177 7 a183 1 @@@@ -470,2 +490,2 @@@@ d188 7 a194 1 @@@@ -599 +619 @@@@ d197 7 a203 1 @@@@ -607 +627 @@@@ d206 7 a212 1 @@@@ -639 +659,3 @@@@ d217 1 a217 1 @@@@ -641 +663 @@@@ d220 6 a225 1 @@@@ -648 +670 @@@@ d228 4 a231 1 @@@@ -653 +675 @@@@ d234 7 a240 1 @@@@ -677,0 +700,3 @@@@ d244 1 a244 1 @@@@ -679 +704 @@@@ d247 5 a251 1 @@@@ -684,0 +710,21 @@@@ d273 15 a287 3 @@@@ -721,0 +768 @@@@ +#endif @@@@ -730 +777,3 @@@@ d292 7 a298 1 @@@@ -761,0 +811,3 @@@@ d302 3 a304 1 @@@@ -765 +817,2 @@@@ d308 7 a314 1 @@@@ -777,0 +831,35 @@@@ d350 7 a356 1 @@@@ -798,0 +887,4 @@@@ d361 13 a373 3 @@@@ -803,0 +896 @@@@ +#endif @@@@ -823 +916 @@@@ d376 1 a376 1 @@@@ -825,3 +918,7 @@@@ d387 7 a393 1 @@@@ -840,0 +938,8 @@@@ d402 13 a414 3 @@@@ -845,0 +951 @@@@ +#endif @@@@ -854 +960 @@@@ d417 7 a423 1 @@@@ -869 +975,3 @@@@ d428 9 a436 3 @@@@ -872,0 +981 @@@@ +#endif @@@@ -878 +987 @@@@ d439 7 a445 1 @@@@ -893 +1002 @@@@ d448 3 @ 1.4 log @make it work under linux again. @ text @d1 1 a1 1 $NetBSD: patch-aj,v 1.3 2003/11/11 10:42:32 wiz Exp $ d4 2 a5 5 +++ fep_main.c 2004-02-20 09:50:33.000000000 -0500 @@@@ -3,15 +3,25 @@@@ #ifndef lint static char rcsid[]= "$Id: fep_main.c,v 4.11 1993/06/10 02:51:28 utashiro Exp $ (SRA)"; d8 1 a8 6 #include #include #include #include #include d11 2 a13 1 +#ifdef __linux__ a16 2 +#include +#endif d18 2 a19 1 #include d21 1 a21 8 +#include #include #include #include @@@@ -30,7 +40,7 @@@@ #ifdef STAT static char fep_statrc[] = FEP_STAT; #endif d24 1 a24 7 char *myself; /* the command name */ char *prompt = ""; /* prompt string */ @@@@ -38,9 +48,9 @@@@ /* delimiter characters */ int master; /* file discriptor for pty master */ int slave; /* file discriptor for pty slave */ d31 1 a31 7 int selectnfds; /* max (fileno(stdin), master) + 1*/ int child_pid; /* child pid */ int ptyflag = ON; /* flag to use pty or not */ @@@@ -48,27 +58,34 @@@@ int debug = OFF; /* debug switch */ int auto_tty_fix = ON; /* fix tty mode automaticaly */ FILE *script_fp = NULL; /* script file pointer */ d34 1 a34 1 d46 1 a46 5 int lines; /* terminal line size */ int columns; /* terminal coulumn size */ char *term_clear; /* terminal clear code */ d49 1 a49 2 /* function buffer for signal */ d51 1 a51 2 struct tchars tchars_buf; /* tty characters */ struct ltchars ltchars_buf; /* tty characters */ d53 1 a53 5 int lmode_buf; /* local mode */ int line_desc; /* line descipline */ #ifdef KANJI struct jtchars jtchars_buf; /* kanji tty characters */ int kmode_buf; /* kanji mode */ d56 1 a56 7 char master_tty[16]; /* master tty name */ char slave_tty[16]; /* slave tty name */ @@@@ -112,6 +129,10 @@@@ myself = argv[0]; d61 1 a61 7 /* * Initialize binding table */ @@@@ -172,7 +193,7 @@@@ histlen = atoi (argv[1]); } else { d64 1 a64 7 } break; @@@@ -276,7 +297,7 @@@@ fix_signal () { #ifdef SIGWINCH d67 1 a67 7 #endif sighup = signal (SIGHUP, terminate); @@@@ -336,7 +357,7 @@@@ if (Through == OFF && Transparency == OFF && script_fp) fwrite (inputline, sizeof(CHAR), strlen (inputline), script_fp); } d70 1 a70 7 } #define INPUT_BUFFER_SIZE 1024 @@@@ -384,7 +405,8 @@@@ { char c; int n; d74 1 a74 7 #ifdef USE_TIMEOUT struct timeval **timeout = auto_tty_fix ? timeout_list : notimeout; #else @@@@ -396,9 +418,8 @@@@ /* * Sorry, this cording depends to an implementation of getc(). */ d80 1 a80 7 RETRY: readfd = selectmask; @@@@ -409,13 +430,13 @@@@ while ((nfound = select (selectnfds, &readfd, 0, 0, *timeout)) < 0) if (errno != EINTR) { perror ("select"); d83 1 a83 5 } /* * Found output from pty. */ d86 1 a86 7 int nbyte; /* @@@@ -451,7 +472,7 @@@@ /* * Found input from terminal */ d89 1 a89 7 #ifndef USE_TIMEOUT /* @@@@ -467,8 +488,8 @@@@ RETURNCHAR: if ((c = getc (stdin)) == EOF) { if (debug) d94 1 a94 7 } else return (c & CHARMASK); @@@@ -596,7 +617,7 @@@@ swallow_output() { d97 1 a97 7 int r; int nbyte; int ncount = 10; @@@@ -604,7 +625,7 @@@@ while ( ncount-- && select (selectnfds, &readfd, 0, 0, TIMEOUT_NOBLOCK) > 0 && d100 1 a100 7 ) { nbyte = buf_read (master, output_buffer); if (nbyte > 0) { @@@@ -636,21 +657,23 @@@@ #include #endif d105 1 a105 1 { d108 1 a108 6 struct rusage ru; if (wait3 (&status, WNOHANG | WUNTRACED, &ru) != child_pid) return; if (WIFSTOPPED (status) /* || WIFSIGNALED (status) */) { if (debug) { d111 1 a111 4 } suspend (); return; } d114 1 a114 7 } exec_to_command(argv) @@@@ -675,13 +698,37 @@@@ dup2 (slave, 2); (void) close (slave); d118 1 a118 1 ioctl (0, TIOCSETN, (char *) & slave_ttymode); d121 1 a121 5 execvp (*argv, argv, 0); perror (*argv); exit (1); } d143 3 a145 15 fix_tty() { struct tchars tcbuf; @@@@ -719,6 +766,7 @@@@ ioctl (0, TIOCSETC, (char *) & tcbuf); ioctl (0, TIOCSLTC, (char *) & lcbuf); } +#endif kill_process() { @@@@ -727,7 +775,9 @@@@ (void) killpg (child_pid, SIGTERM); } d150 1 a150 7 { extern int errno; @@@@ -759,10 +809,14 @@@@ if (killpg (child_pid, SIGKILL) < 0) perror ("kill"); d154 1 a154 3 ioctl (0, TIOCSETN, (char *) & initial_ttymode); ioctl (0, TIOCSETC, (char *) & tchars_buf); ioctl (0, TIOCSLTC, (char *) & ltchars_buf); d158 1 a158 7 } get_pty_master() @@@@ -775,6 +829,41 @@@@ master = 1; return; } d194 1 a194 7 for (c = 'p'; c <= 's'; c++) { for (i = 0; i < 16; i++) { sprintf (master_tty, "/dev/pty%c%x", c, i); @@@@ -796,11 +885,16 @@@@ } FOUND: d199 3 a201 13 ioctl (0, TIOCGETP, (char *) &initial_ttymode); ioctl (0, TIOCGETC, (char *) &tchars_buf); ioctl (0, TIOCGETD, (char *) &line_desc); ioctl (0, TIOCGLTC, (char *) <chars_buf); ioctl (0, TIOCLGET, (char *) &lmode_buf); +#endif #ifdef TIOCGWINSZ { @@@@ -820,11 +914,15 @@@@ # if defined(TIOCKGETC) && defined(TIOCKSETC) ioctl (0, TIOCKGETC, (char *) &jtchars_buf); # endif d204 1 a204 1 d215 1 a215 7 selectnfds = max (fileno(stdin), master) + 1; return; @@@@ -838,11 +936,20 @@@@ perror (slave_tty); exit (1); } d224 3 a226 13 ioctl (slave, TIOCSETN, (char *) &initial_ttymode); ioctl (slave, TIOCSETC, (char *) &tchars_buf); ioctl (slave, TIOCSLTC, (char *) <chars_buf); ioctl (slave, TIOCLSET, (char *) &lmode_buf); ioctl (slave, TIOCSETD, (char *) &line_desc); +#endif #ifdef KANJI # if defined(TIOCKGET) && defined(TIOCKSET) @@@@ -851,7 +958,7 @@@@ # if defined(TIOCKGETC) && defined(TIOCKSETC) ioctl (slave, TIOCKSETC, (char *) &jtchars_buf); # endif d229 1 a229 7 #ifdef TIOCSWINSZ { @@@@ -866,16 +973,19 @@@@ recover_tty() { d234 3 a236 9 ioctl (0, TIOCSETN, (char *) & initial_ttymode); ioctl (0, TIOCSETC, (char *) & tchars_buf); ioctl (0, TIOCSLTC, (char *) & ltchars_buf); +#endif } suspend() { long pid; d239 1 a239 7 int omask; extern int errno; @@@@ -890,7 +1000,7 @@@@ if (kill (child_pid, SIGCONT) < 0 && errno == ESRCH) { printf ("Where my child has gone?!\n"); a241 3 } killpg (child_pid, SIGCONT); kill (0, SIGCONT); @ 1.3 log @Make patches apply again; use sed script in pre-build to remove stuff after #endif to avoid RCS problems with patches (hi christos!). @ text @d1 1 a1 1 $NetBSD$ d3 11 a13 3 --- fep_main.c.orig Thu Jun 10 04:53:06 1993 +++ fep_main.c @@@@ -10,8 +10,17 @@@@ static char rcsid[]= d24 1 d33 1 a33 1 @@@@ -30,7 +39,7 @@@@ static char rcsid[]= d42 1 a42 1 @@@@ -38,9 +47,9 @@@@ char *delimiters = DEFAULT_DELIMITERS; d55 1 a55 1 @@@@ -48,27 +57,34 @@@@ int histlen = -1; /* history length */ d96 1 a96 1 @@@@ -112,6 +128,10 @@@@ main(argc, argv) d107 10 a116 1 @@@@ -276,7 +296,7 @@@@ DEFAULT: d125 1 a125 1 @@@@ -336,7 +356,7 @@@@ input_handler() d134 1 a134 1 @@@@ -384,7 +404,8 @@@@ getcharacter() d144 1 a144 1 @@@@ -396,9 +417,8 @@@@ getcharacter() d156 1 a156 1 @@@@ -409,13 +429,13 @@@@ RETRY: d172 1 a172 1 @@@@ -451,7 +471,7 @@@@ RETRY: d181 1 a181 1 @@@@ -467,8 +487,8 @@@@ RETRY: d192 1 a192 1 @@@@ -596,7 +616,7 @@@@ buf_put (bp, s) d201 1 a201 1 @@@@ -604,7 +624,7 @@@@ swallow_output() d210 1 a210 1 @@@@ -636,21 +656,23 @@@@ swallow_output() d238 1 a238 1 @@@@ -675,13 +697,37 @@@@ exec_to_command(argv) d277 1 a277 1 @@@@ -719,6 +765,7 @@@@ fix_tty() d285 1 a285 1 @@@@ -727,7 +774,9 @@@@ kill_process() d296 1 a296 1 @@@@ -759,10 +808,14 @@@@ terminate() d312 43 a354 1 @@@@ -796,11 +849,15 @@@@ get_pty_master() d358 1 d371 1 a371 1 @@@@ -820,11 +877,15 @@@@ get_pty_master() d391 1 a391 1 @@@@ -838,11 +899,15 @@@@ get_pty_slave() d395 5 d412 1 a412 1 @@@@ -851,7 +916,7 @@@@ get_pty_slave() d421 1 a421 1 @@@@ -866,16 +931,19 @@@@ get_pty_slave() d443 1 a443 1 @@@@ -890,7 +958,7 @@@@ suspend() @ 1.2 log @- kill gcc-3 preprocessor warnings about #{else,endif} TAG - exit with the child's exit value and with non zero on error @ text @d3 3 a5 11 --- fep_main.c.orig 1993-06-09 22:53:06.000000000 -0400 +++ fep_main.c 2003-11-07 11:28:23.000000000 -0500 @@@@ -3,15 +3,24 @@@@ #ifndef lint static char rcsid[]= "$Id: fep_main.c,v 4.11 1993/06/10 02:51:28 utashiro Exp $ (SRA)"; -#endif lint +#endif /* lint */ #include #include d24 1 a24 1 @@@@ -30,7 +39,7 @@@@ d33 1 a33 1 @@@@ -38,9 +47,9 @@@@ d46 1 a46 1 @@@@ -48,27 +57,34 @@@@ d87 1 a87 1 @@@@ -112,6 +128,10 @@@@ d98 1 a98 1 @@@@ -276,7 +296,7 @@@@ d107 1 a107 1 @@@@ -336,7 +356,7 @@@@ d116 1 a116 1 @@@@ -384,7 +404,8 @@@@ d126 1 a126 1 @@@@ -396,9 +417,8 @@@@ d138 1 a138 1 @@@@ -409,13 +429,13 @@@@ d154 1 a154 1 @@@@ -451,7 +471,7 @@@@ d163 1 a163 1 @@@@ -467,8 +487,8 @@@@ d174 1 a174 1 @@@@ -596,7 +616,7 @@@@ d183 1 a183 1 @@@@ -604,7 +624,7 @@@@ d192 1 a192 1 @@@@ -636,21 +656,23 @@@@ d220 1 a220 1 @@@@ -675,13 +697,37 @@@@ d259 1 a259 1 @@@@ -719,6 +765,7 @@@@ d267 1 a267 1 @@@@ -727,7 +774,9 @@@@ d278 1 a278 1 @@@@ -759,10 +808,14 @@@@ d294 1 a294 1 @@@@ -796,11 +849,15 @@@@ d310 1 a310 1 @@@@ -820,11 +877,15 @@@@ d330 1 a330 1 @@@@ -838,11 +899,15 @@@@ d346 1 a346 1 @@@@ -851,7 +916,7 @@@@ d355 1 a355 1 @@@@ -866,16 +931,19 @@@@ d377 1 a377 1 @@@@ -890,7 +958,7 @@@@ @ 1.1 log @- fix slews of bugs - modernize - use termios @ text @d3 11 a13 3 --- fep_main.c.orig Wed Jun 9 22:53:06 1993 +++ fep_main.c Sun Feb 6 22:00:22 2000 @@@@ -10,8 +10,17 @@@@ d32 9 d54 1 a54 1 @@@@ -48,21 +57,28 @@@@ d88 7 d151 1 a151 1 + terminate(0); d171 2 a172 1 @@@@ -468,7 +488,7 @@@@ d175 1 a175 1 printf ("EOF chatched\n"); d177 2 a178 1 + terminate (0); d200 1 a200 1 @@@@ -636,9 +656,11 @@@@ d214 6 a219 1 @@@@ -650,7 +672,7 @@@@ d224 1 a224 1 + terminate (0); d286 1 a286 1 @@@@ -759,9 +808,13 @@@@ d296 1 d298 1 a298 1 exit (0); d301 1 d318 3 a320 1 @@@@ -822,9 +879,13 @@@@ d322 2 a323 1 #endif KANJI d354 9 d390 1 a390 1 + terminate (0); @