diff --git a/src/frontend/com_shell.c b/src/frontend/com_shell.c index a2a73d098..d6f9c6f2c 100644 --- a/src/frontend/com_shell.c +++ b/src/frontend/com_shell.c @@ -29,8 +29,6 @@ com_shell(wordlist *wl) shell = SHELL; } - cp_ccon(FALSE); - #ifdef HAVE_VFORK_H /* XXX Needs to switch process groups. Also, worry about suspend */ /* Only bother for efficiency */ diff --git a/src/frontend/cpitf.c b/src/frontend/cpitf.c index a132b7580..eb047f54c 100644 --- a/src/frontend/cpitf.c +++ b/src/frontend/cpitf.c @@ -69,13 +69,7 @@ ft_cpinit(void) "vr(x)", "re(v(x))", "vr(x,y)", "re(v(x) - v(y))" }; -#ifndef SHARED_MODULE - /* if TIOCSTI is defined (not available in MS Windows: - Make escape the break character. - So the user can type ahead... - fcn defined in complete.c. */ - cp_ccon(TRUE); -#endif + /* Initialize io, cp_chars[], variable "history" in init.c. */ cp_init(); diff --git a/src/frontend/error.c b/src/frontend/error.c index c78a00f23..dc168f5fc 100644 --- a/src/frontend/error.c +++ b/src/frontend/error.c @@ -65,8 +65,6 @@ ft_sperror(int code, char *mess) void fatal(void) { - cp_ccon(FALSE); - #if defined(FTEDEBUG) && defined(SIGQUIT) (void) signal(SIGQUIT, SIG_DFL); (void) kill(getpid(), SIGQUIT); diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index 67aafb128..dd9551028 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -58,10 +58,8 @@ com_quit(wordlist *wl) (wl && wl->wl_word && cieq(wl->wl_word, "noask")) || !cp_getvar("askquit", CP_BOOL, NULL, 0); - /* update screen and reset terminal */ + /* Update screen. */ gr_clean(); - cp_ccon(FALSE); - /* Make sure the guy really wants to quit. */ if (!ft_nutmeg) diff --git a/src/frontend/parser/complete.c b/src/frontend/parser/complete.c index 8dc8c2ff0..d60bd677d 100644 --- a/src/frontend/parser/complete.c +++ b/src/frontend/parser/complete.c @@ -40,22 +40,6 @@ Modified: 1999 Paolo Nenzi #include #endif -/* Be sure the ioctls get included in the following */ -#ifdef HAVE_SGTTY_H -#include -#else -#ifdef HAVE_TERMIO_H -#include -#else -#ifdef HAVE_TERMIOS_H -#include -#endif -#endif -#endif - - -#define CNTRL_D '\004' -#define ESCAPE '\033' #define NCLASSES 32 bool cp_nocc; /* Don't do command completion. */ @@ -349,96 +333,6 @@ cp_cctowl(struct ccom *stuff) } -/* Turn on and off the escape break character and cooked mode. */ - -void -cp_ccon(bool on) -{ -#ifdef TIOCSTI -#ifdef HAVE_SGTTY_H - static bool ison = FALSE; - struct tchars tbuf; - struct sgttyb sbuf; - - if (cp_nocc || !cp_interactive || (ison == on)) - return; - ison = on; - - /* Set the terminal up -- make escape the break character, and - * make sure we aren't in raw or cbreak mode. Hope the (void) - * ioctl's won't fail. - */ - (void) ioctl(fileno(cp_in), TIOCGETC, &tbuf); - if (on) - tbuf.t_brkc = ESCAPE; - else - tbuf.t_brkc = '\0'; - (void) ioctl(fileno(cp_in), TIOCSETC, &tbuf); - - (void) ioctl(fileno(cp_in), TIOCGETP, &sbuf); - sbuf.sg_flags &= ~(RAW|CBREAK); - (void) ioctl(fileno(cp_in), TIOCSETP, &sbuf); -#else - -# ifdef HAVE_TERMIO_H - -# define TERM_GET TCGETA -# define TERM_SET TCSETA - static struct termio sbuf; - static struct termio OS_Buf; - -# else -# ifdef HAVE_TERMIOS_H - - -# define TERM_GET TCGETS -# define TERM_SET TCSETS - static struct termios sbuf; - static struct termios OS_Buf; - -# endif -# endif - -#ifdef TERM_GET - static bool ison = FALSE; - - if (cp_nocc || !cp_interactive || (ison == on)) - return; - ison = on; - - if (ison == TRUE) { -#if HAVE_TCGETATTR - tcgetattr(fileno(cp_in), &OS_Buf); -#else - (void) ioctl(fileno(cp_in), TERM_GET, &OS_Buf); -#endif - sbuf = OS_Buf; - sbuf.c_cc[VEOF] = '\0'; - sbuf.c_cc[VEOL] = ESCAPE; - sbuf.c_cc[VEOL2] = CNTRL_D; -#if HAVE_TCSETATTR - tcsetattr(fileno(cp_in), TCSANOW, &sbuf); -#else - (void) ioctl(fileno(cp_in), TERM_SET, &sbuf); -#endif - } else { -#ifdef HAVE_TCSETATTR - tcsetattr(fileno(cp_in), TCSANOW, &OS_Buf); -#else - (void) ioctl(fileno(cp_in), TERM_SET, &OS_Buf); -#endif - } - -# endif -#endif - -#else - NG_IGNORE(on); -#endif - -} - - /* The following routines deal with the command and keyword databases. * Say whether a given word exists in the command database. */ diff --git a/src/frontend/parser/cshpar.c b/src/frontend/parser/cshpar.c index b4cfa7fc8..1c8760afe 100644 --- a/src/frontend/parser/cshpar.c +++ b/src/frontend/parser/cshpar.c @@ -13,18 +13,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #include "cshpar.h" -#ifdef HAVE_SGTTY_H -#include -#else -#ifdef HAVE_TERMIO_H -#include -#else -#ifdef HAVE_TERMIOS_H -#include -#endif -#endif -#endif - #ifdef HAVE_UNISTD_H #include #endif diff --git a/src/frontend/parser/lexical.c b/src/frontend/parser/lexical.c index 370ce1447..4a2468f44 100644 --- a/src/frontend/parser/lexical.c +++ b/src/frontend/parser/lexical.c @@ -22,26 +22,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #endif -/* MW. Linux has TIOCSTI, so we include all headers here */ -#if !defined(__MINGW32__) && !defined(_MSC_VER) -#include -#endif - -#ifdef HAVE_SGTTY_H -#include -#include -#else -#ifdef HAVE_TERMIO_H -#include -#include -#else -#ifdef HAVE_TERMIOS_H -#include -#include -#endif -#endif -#endif - #include "ngspice/fteinput.h" #include "lexical.h" @@ -73,12 +53,8 @@ bool cp_bqflag = FALSE; char *cp_promptstring = NULL; char *cp_altprompt = NULL; -static int numeofs = 0; - - #define ESCAPE '\033' - /* Return a list of words, with backslash quoting and '' quoting done. * Strings enclosed in "" or `` are made single words and returned, * but with the "" or `` still present. For the \ and '' cases, the @@ -155,7 +131,6 @@ wordlist * cp_lexer(char *string) { int c, d; - int i; wordlist *wlist, *wlist_tail; struct cp_lexer_buf buf, linebuf; int paren; @@ -165,7 +140,6 @@ cp_lexer(char *string) /* prompt for string if none is passed */ if (!string && cp_interactive) { - cp_ccon(TRUE); prompt(); } @@ -194,11 +168,8 @@ nloop: if (string && (c == ESCAPE)) continue; - if ((c != EOF) && (c != ESCAPE)) - push(&linebuf, c); - if (c != EOF) - numeofs = 0; + push(&linebuf, c); /* if '\' or '^', add following character to linebuf */ if ((c == '\\' && DIR_TERM != '\\') || (c == '\026') /* ^V */ ) { @@ -293,70 +264,6 @@ nloop: push(&linebuf, d); break; - case '\004': - case EOF: - /* upon command completion, not used actually */ - if (cp_interactive && !cp_nocc && !string) { - - if (linebuf.i == 0) { - if (cp_ignoreeof && (numeofs++ < 23)) { - fputs("Use \"quit\" to quit.\n", stdout); - } else { - fputs("quit\n", stdout); - cp_doquit(); - } - append(NULL); - goto done; - } - - push(&buf, '\0'); - push(&linebuf, '\0'); - - // cp_ccom doesn't mess wlist, read only access to wlist->wl_word - cp_ccom(wlist, buf.s, FALSE); - (void) fputc('\r', cp_out); - prompt(); - for (i = 0; linebuf.s[i]; i++) -#ifdef TIOCSTI - (void) ioctl(fileno(cp_out), TIOCSTI, linebuf.s + i); -#else - fputc(linebuf.s[i], cp_out); /* But you can't edit */ -#endif - goto nloop; - } - - /* EOF during a source */ - if (cp_interactive) { - fputs("quit\n", stdout); - cp_doquit(); - append(NULL); - goto done; - } - - wl_free(wlist); - tfree(buf.s); - tfree(linebuf.s); - return NULL; - - case ESCAPE: - /* upon command completion, not used actually */ - if (cp_interactive && !cp_nocc) { - push(&buf, '\0'); - push(&linebuf, '\0'); - fputs("\b\b \b\b\r", cp_out); - prompt(); - for (i = 0; linebuf.s[i]; i++) -#ifdef TIOCSTI - (void) ioctl(fileno(cp_out), TIOCSTI, linebuf.s + i); -#else - fputc(linebuf.s[i], cp_out); /* But you can't edit */ -#endif - // cp_ccom doesn't mess wlist, read only access to wlist->wl_word - cp_ccom(wlist, buf.s, TRUE); - goto nloop; - } - goto ldefault; - case ',': if ((paren < 1) && (buf.i > 0)) { newword; diff --git a/src/frontend/signal_handler.c b/src/frontend/signal_handler.c index 4e72bfcf7..4d4d6ec2c 100644 --- a/src/frontend/signal_handler.c +++ b/src/frontend/signal_handler.c @@ -91,7 +91,6 @@ ft_sigintr(void) if (interrupt_counter >= 3) { fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter); - cp_ccon(FALSE); controlled_exit(1); } @@ -149,7 +148,6 @@ void sigstop(void) { gr_clean(); - cp_ccon(FALSE); if (!cp_background) { (void) signal(SIGTSTP, SIG_DFL); (void) kill(getpid(), SIGTSTP); /* This should stop us */ diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 205ea969b..bef5a72f9 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -22,7 +22,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group bool cp_noglob = FALSE; bool cp_nonomatch = FALSE; bool cp_noclobber = FALSE; -bool cp_ignoreeof = FALSE; bool cp_echo = FALSE; /* CDHW */ struct variable *variables = NULL; @@ -245,7 +244,7 @@ void cp_vset(const char *varname, enum cp_types type, /* Process special variables: noglob, nonomatch, history, - * noclobber, echo, prompt, ignoreeof, cpdebug, and no_histsubst + * noclobber, echo, prompt, cpdebug, and no_histsubst * by setting the values of associated option variables. * * Parmeters @@ -260,8 +259,7 @@ static void update_option_variables(const char *sz_var_name, ['h' - 'a'] = 2, /* history */ ['e' - 'a'] = 3, /* echo */ ['p' - 'a'] = 4, /* prompt, program */ - ['i' - 'a'] = 5, /* ignoreeof */ - ['c' - 'a'] = 6 /* cpdebug */ + ['c' - 'a'] = 5 /* cpdebug */ }; unsigned int index0 = (unsigned int) sz_var_name[0] - 'a'; @@ -365,11 +363,6 @@ static void update_option_variables(const char *sz_var_name, } return; /* not of interest */ case 5: - if (eq(sz_var_name + 1, "gnoreeof")) { /* ignoreeof */ - cp_ignoreeof = f_set; - } - return; - case 6: if (eq(sz_var_name + 1, "pdebug")) { /* cpdebug */ cp_debug = f_set; #ifndef CPDEBUG diff --git a/src/include/ngspice/cpextern.h b/src/include/ngspice/cpextern.h index 00ab7f7da..0440d4187 100644 --- a/src/include/ngspice/cpextern.h +++ b/src/include/ngspice/cpextern.h @@ -40,7 +40,6 @@ extern struct ccom *cp_kwswitch(int kw_class, struct ccom *tree); extern void cp_addcomm(char *word, long int bits0, long int bits1, long int bits2, long int bits3); extern void cp_addkword(int kw_class, char *word); extern void cp_ccom(wordlist *wlist, char *buf, bool esc); -extern void cp_ccon(bool on); extern void cp_ccrestart(bool kwords); extern void cp_remcomm(char *word); extern void cp_remkword(int kw_class, const char *word); @@ -152,7 +151,6 @@ enum cp_types { CP_LIST }; -extern bool cp_ignoreeof; extern bool cp_noclobber; extern bool cp_noglob; extern bool cp_nonomatch; diff --git a/src/include/ngspice/ngspice.h b/src/include/ngspice/ngspice.h index 842a90e4f..f886a0db0 100644 --- a/src/include/ngspice/ngspice.h +++ b/src/include/ngspice/ngspice.h @@ -60,18 +60,6 @@ #include #endif -#ifdef HAVE_TERMIOS_H -#include -#else -# ifdef HAVE_SGTTY_H -# include -# else -# ifdef HAVE_TERMIO_H -# include -# endif -# endif -#endif - #ifdef HAVE_PWD_H #include #endif diff --git a/src/ngsconvert.c b/src/ngsconvert.c index 00dca03c7..96ab3f83a 100644 --- a/src/ngsconvert.c +++ b/src/ngsconvert.c @@ -495,7 +495,6 @@ void out_init(void) { } void cp_doquit(void) { exit(0); } struct variable *cp_usrvars(void) { return NULL; } int cp_evloop(char *s) { NG_IGNORE(s); return (0); } -void cp_ccon(bool o) { NG_IGNORE(o); } char*if_errstring(int c) { NG_IGNORE(c); return strdup("error"); } void out_printf(char *fmt, ...) { NG_IGNORE(fmt); } void out_send(char *string) { NG_IGNORE(string); }