$NetBSD: patch-ae,v 1.1 2000/02/07 03:18:11 christos Exp $ --- fep_edit.c.orig Fri Jan 20 03:16:37 1995 +++ fep_edit.c Sun Feb 6 21:46:22 2000 @@ -8,7 +8,17 @@ #include #include #include +#include +#ifdef TERMIOS +#include +#ifdef __linux__ +#ifndef _POSIX_VDISABLE +#define _POSIX_VDISABLE '\0' +#endif +#endif +#else #include +#endif #include #include #include @@ -25,7 +35,7 @@ EDITMODE editmode = NOTYET; /* edtimode EMACS, VI */ EDITSTATUS editstatus = NOTEDITING;/* EDITING, NOTEDITING */ -int maxline = MAXCOMLEN; /* maximum length of command line */ +int maxline = MAXCMDLEN; /* maximum length of command line */ int NeedNewLine; /* add new line flag */ int NeedSave; /* need to save to history */ int Transparency = OFF; /* transparent flag */ @@ -86,7 +96,7 @@ /* ^X-^V */ {"\\^X\\^V", view_buffer}, /* ^X-^K */ {"\\^X\\^K", kill_to_top_of_line}, /* ^X-^L */ {"\\^X\\^L", fep_repaint}, - /* ^X-^C */ {"\\^X\\^C", terminate}, + /* ^X-^C */ {"\\^X\\^C", (FUNC)terminate}, /* ^X-^D */ {"\\^X\\^D", send_eof}, /* ^X-( */ {"\\^X(", fep_start_script}, /* ^X-) */ {"\\^X)", fep_end_script}, @@ -192,6 +202,30 @@ #define import(table,key,fn) if((int)key>0)table[(int)key]=fn +#ifdef TERMIOS + /* Now, using cbreak mode + import (cft, initial_ttymode.c_cc[VSTART], ignore); + import (cft, initial_ttymode.c_cc[VSTOP], ignore); + */ + import (cft, initial_ttymode.c_cc[VINTR], insert_and_flush); + import (cft, initial_ttymode.c_cc[VQUIT], insert_and_flush); + /* Now, EOF will be sent on empty line. + import (cft, initial_ttymode.c_cc[VEOF], send_eof); + */ +#ifdef VSWTC + import (cft, initial_ttymode.c_cc[VSWTC], insert_and_flush); +#endif + import (cft, initial_ttymode.c_cc[VSUSP], insert_and_flush); + /* ^Y is used for yank-from-kill-buffer + import (cft, initial_ttymode.c_cc[VDSUSP], self_insert); + */ + import (cft, initial_ttymode.c_cc[VREPRINT], reprint); + import (cft, initial_ttymode.c_cc[VDISCARD], self_insert); + import (cft, initial_ttymode.c_cc[VWERASE], delete_previous_word); + import (cft, initial_ttymode.c_cc[VLNEXT], literal_next); + import (cft, initial_ttymode.c_cc[VERASE], delete_previous_character); + import (cft, initial_ttymode.c_cc[VKILL], delete_line); +#else /* Now, using cbreak mode import (cft, tchars_buf.t_startc, ignore); import (cft, tchars_buf.t_stopc, ignore); @@ -212,6 +246,7 @@ import (cft, ltchars_buf.t_lnextc, literal_next); import (cft, initial_ttymode.sg_erase, delete_previous_character); import (cft, initial_ttymode.sg_kill, delete_line); +#endif #undef import @@ -257,7 +292,7 @@ */ swallow_output(); - if (fgets (CommandLine, MAXCOMLEN, redirect_fp)) { + if (fgets (CommandLine, MAXCMDLEN, redirect_fp)) { ++redirect_line; execute_command = CommandLine; goto RETURN; @@ -301,7 +336,11 @@ * call send_eof */ if ( +#ifdef TERMIOS + c == initial_ttymode.c_cc[VEOF] +#else c == tchars_buf.t_eofc +#endif && curFuncTab[c] != send_eof && ! look_var ("ignore-eof") && CommandLine [0] == '\0' @@ -1481,7 +1520,11 @@ */ send_eof() { +#ifdef TERMIOS + char c = initial_ttymode.c_cc[VEOF]; +#else char c = tchars_buf.t_eofc; +#endif (void) self_insert (c); if (isctlchar (c)) @@ -1754,7 +1797,7 @@ fileList [i] = (char *) 0; if (*start_expand == '~' && look_var ("expand-tilde")) { - char *buf [256], *p; + char buf [256], *p; strcpy (buf, start_expand); p = x_dirname (buf); @@ -2032,7 +2075,7 @@ { char tmps[16]; - if (s[0] == '\\' && s[1] == '^' && s[2] != NULL) { + if (s[0] == '\\' && s[1] == '^' && s[2] != '\0') { tmps[0] = toctrl (s[2]); strcpy (&tmps[1], &s[3]); s = tmps; @@ -2042,7 +2085,7 @@ * If the string contain only one character, put the function to * appropriate position in the table. */ - if (*(s+1) == NULL) { + if (*(s+1) == '\0') { if (isIndirect (ft[(int) *s])) free (maskIndirect (ft[(int) *s]));