From owner-freebsd-ports Thu Sep 27 11:30:55 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id AFDF937B425 for ; Thu, 27 Sep 2001 11:30:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8RIU3t84110; Thu, 27 Sep 2001 11:30:03 -0700 (PDT) (envelope-from gnats) Received: from navy.csi.cam.ac.uk (navy.csi.cam.ac.uk [131.111.8.49]) by hub.freebsd.org (Postfix) with ESMTP id B31F237B406 for ; Thu, 27 Sep 2001 11:24:33 -0700 (PDT) Received: from m218-3.phy.cam.ac.uk ([131.111.79.217]) by navy.csi.cam.ac.uk with esmtp (Exim 3.22 #1) id 15mfpo-0000MO-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 27 Sep 2001 19:24:32 +0100 Received: from sa264 by m218-3.phy.cam.ac.uk with local (Exim 3.33 #1) id 15mfpo-0006CJ-00; Thu, 27 Sep 2001 19:24:32 +0100 Message-Id: Date: Thu, 27 Sep 2001 19:24:32 +0100 From: AMAKAWA Shuhei Reply-To: AMAKAWA Shuhei To: FreeBSD-gnats-submit@freebsd.org Cc: sa264@cam.ac.uk X-Send-Pr-Version: 3.113 Subject: ports/30875: fix bug in 'prompt' variable processing in cad/cider Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30875 >Category: ports >Synopsis: fix bug in 'prompt' variable processing in cad/cider >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Thu Sep 27 11:30:03 PDT 2001 >Closed-Date: >Last-Modified: >Originator: AMAKAWA Shuhei >Release: FreeBSD 4.4-STABLE i386 >Organization: >Environment: System: FreeBSD m218-3.phy.cam.ac.uk 4.4-STABLE FreeBSD 4.4-STABLE #0: Thu Sep 27 07:01:16 BST 2001 sa264@m218-3.phy.cam.ac.uk:/usr/obj/usr/src/sys/KERNCONF i386 >Description: Fix a bug in the 'prompt' variable processing in cad/cider. I am the maintainer. >How-To-Repeat: Run cider (or spice3). set prompt = 'Spice \! -> ' Now the prompt should look like 'Spice ! -> ' but it doesn't. >Fix: diff -uNr /usr/ports/cad/cider/Makefile cider/Makefile --- /usr/ports/cad/cider/Makefile Thu Jul 5 08:34:07 2001 +++ cider/Makefile Thu Sep 20 00:12:34 2001 @@ -7,7 +7,7 @@ PORTNAME= cider PORTVERSION= 1.b1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= cad MASTER_SITES= ftp://ic.eecs.berkeley.edu/pub/Cider/new/ DISTNAME= cider1b1 diff -uNr /usr/ports/cad/cider/files/patch-ad cider/files/patch-ad --- /usr/ports/cad/cider/files/patch-ad Sat Oct 28 17:13:06 2000 +++ cider/files/patch-ad Thu Sep 20 00:12:34 2001 @@ -1,213 +1,197 @@ -*** spice/common/src/bin/main.c.orig Sat Mar 12 08:22:28 1994 ---- spice/common/src/bin/main.c Tue Oct 24 03:32:20 2000 -*************** -*** 25,30 **** ---- 25,37 ---- - #include - #endif - -+ #ifdef HAS_GNUREADLINE -+ /* Added GNU Readline Support 11/3/97 -- Andrew Veliath */ -+ #include -+ #include -+ #include "fteinput.h" -+ #endif -+ - #ifdef HAS_UNIX_SIGS - #include - #endif -*************** -*** 36,41 **** ---- 43,53 ---- - #endif - - #include "patchlev.h" -+ -+ #ifdef __FreeBSD__ -+ #include -+ #endif -+ - #include "suffix.h" - - /* (Virtual) Machine architecture parameters */ -*************** -*** 53,58 **** ---- 65,75 ---- - bool ft_intrpt = false; /* Set by the (void) signal handlers. */ - bool ft_setflag = false; /* Don't abort after an interrupt. */ - -+ #ifdef HAS_GNUREADLINE -+ char gnu_history_file[512]; -+ static char *application_name; -+ #endif -+ - struct variable *(*if_getparam)( ); - - #ifdef BATCH -*************** -*** 185,190 **** ---- 202,294 ---- - - #endif - -+ #ifdef HAS_GNUREADLINE -+ /* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath */ -+ static char * -+ prompt() -+ { -+ static char pbuf[128]; -+ int n = sizeof(pbuf); -+ char *p = pbuf, *s; -+ -+ if (cp_interactive == false) -+ return; -+ if (cp_promptstring == NULL) -+ s = "-> "; -+ else -+ s = cp_promptstring; -+ if (cp_altprompt) -+ s = cp_altprompt; -+ while (*s && (n > 1)) { -+ int w; -+ switch (strip(*s)) { -+ case '!': -+ w = snprintf(p, n, "%d", where_history() + 1); -+ w = (w >= n) ? n - 1 : w; -+ p += w; -+ n -= w; -+ break; -+ default: -+ *p = strip(*s); ++p; -+ --n; -+ break; -+ } -+ s++; -+ } -+ *p = 0; -+ return pbuf; -+ } -+ -+ /* Process device events in Readline's hook since there is no where -+ else to do it now - AV */ -+ int rl_event_func() -+ { -+ static REQUEST reqst = { checkup_option, 0 }; -+ Input(&reqst, NULL); -+ return 0; -+ } -+ -+ /* Added GNU Readline Support -- Andrew Veliath */ -+ void app_rl_readlines() -+ { -+ char *line, *expanded_line; -+ -+ strcpy(gnu_history_file, getenv("HOME")); -+ strcat(gnu_history_file, "/."); -+ strcat(gnu_history_file, application_name); -+ strcat(gnu_history_file, "_history"); -+ -+ using_history(); -+ read_history(gnu_history_file); -+ -+ rl_readline_name = application_name; -+ rl_instream = cp_in; -+ rl_outstream = cp_out; -+ rl_event_hook = rl_event_func; -+ -+ while (1) { -+ history_set_pos(history_length); -+ line = readline(prompt()); -+ if (line && *line) { -+ int s = history_expand(line, &expanded_line); -+ -+ if (s == 2) { -+ fprintf(stderr, "-> %s\n", expanded_line); -+ } else if (s == -1) { -+ fprintf(stderr, "readline: %s\n", expanded_line); -+ } else { -+ cp_evloop(expanded_line); -+ add_history(expanded_line); -+ } -+ free(expanded_line); -+ } -+ if (line) free(line); -+ else if (line == NULL) cp_evloop("quit"); -+ } -+ /* History gets written in ../fte/misccoms.c com_quit */ -+ } -+ #endif /* HAS_GNUREADLINE */ -+ - char *hlp_filelist[] = { "spice", 0 }; - - void -*************** -*** 216,221 **** ---- 320,329 ---- - - #endif - -+ #ifdef __FreeBSD__ -+ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); -+ #endif -+ - /* MFB tends to jump to 0 on errors. This tends to catch it. */ - if (started) { - fprintf(cp_err, "main: Internal Error: jump to zero\n"); -*************** -*** 236,241 **** ---- 344,356 ---- - ARCHsize = 1; - #endif /* PARALLEL_ARCH */ - -+ #ifdef HAS_GNUREADLINE -+ if (!(application_name = strrchr(av[0],'/'))) -+ application_name = av[0]; -+ else -+ ++application_name; -+ #endif -+ - #ifdef HAS_MAC_ARGCARGV - ac = initmac(&av); - #endif -*************** -*** 472,478 **** ---- 587,597 ---- - # ifdef HAS_UNIX_SIGS - /* Set up (void) signal handling */ - if (!ft_batchmode) { -+ # ifdef HAS_GNUREADLINE -+ (void) signal(SIGINT, SIG_IGN); -+ # else - (void) signal(SIGINT, ft_sigintr); -+ # endif - (void) signal(SIGFPE, sigfloat); - # ifdef SIGTSTP - (void) signal(SIGTSTP, sigstop); -*************** -*** 668,674 **** ---- 787,797 ---- - } else { - (void) setjmp(jbuf); - cp_interactive = true; -+ #ifdef HAS_GNUREADLINE -+ app_rl_readlines(); -+ #else - while (cp_evloop((char *) NULL) == 1) ; -+ #endif /* ifelse HAS_GNUREADLINE */ - } - - # else /* if BATCH */ -*************** -*** 708,714 **** ---- 831,841 ---- - /* Nutmeg "main" */ - (void) setjmp(jbuf); - cp_interactive = true; -+ #ifdef HAS_GNUREADLINE -+ app_rl_readlines(); -+ #else - while (cp_evloop((char *) NULL) == 1) ; -+ #endif /* ifelse HAS_GNUREADLINE */ - - #endif - +--- spice/common/src/bin/main.c.orig Sat Mar 12 08:22:28 1994 ++++ spice/common/src/bin/main.c Wed Sep 19 11:06:34 2001 +@@ -25,6 +25,13 @@ + #include + #endif + ++#ifdef HAS_GNUREADLINE ++/* Added GNU Readline Support 11/3/97 -- Andrew Veliath */ ++#include ++#include ++#include "fteinput.h" ++#endif ++ + #ifdef HAS_UNIX_SIGS + #include + #endif +@@ -36,6 +43,11 @@ + #endif + + #include "patchlev.h" ++ ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include "suffix.h" + + /* (Virtual) Machine architecture parameters */ +@@ -53,6 +65,11 @@ + bool ft_intrpt = false; /* Set by the (void) signal handlers. */ + bool ft_setflag = false; /* Don't abort after an interrupt. */ + ++#ifdef HAS_GNUREADLINE ++char gnu_history_file[512]; ++static char *application_name; ++#endif ++ + struct variable *(*if_getparam)( ); + + #ifdef BATCH +@@ -185,6 +202,95 @@ + + #endif + ++#ifdef HAS_GNUREADLINE ++/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath */ ++static char * ++prompt() ++{ ++ static char pbuf[128]; ++ int n = sizeof(pbuf); ++ char *p = pbuf, *s; ++ ++ if (cp_interactive == false) ++ return; ++ if (cp_promptstring == NULL) ++ s = "-> "; ++ else ++ s = cp_promptstring; ++ if (cp_altprompt) ++ s = cp_altprompt; ++ while (*s && (n > 1)) { ++ int w; ++ switch (strip(*s)) { ++ case '!': ++ w = snprintf(p, n, "%d", where_history() + 1); ++ w = (w >= n) ? n - 1 : w; ++ p += w; ++ n -= w; ++ break; ++ case '\\': ++ if (*(s + 1)) ++s; ++ default: ++ *p = strip(*s); ++p; ++ --n; ++ break; ++ } ++ s++; ++ } ++ *p = 0; ++ return pbuf; ++} ++ ++/* Process device events in Readline's hook since there is no where ++ else to do it now - AV */ ++int rl_event_func() ++{ ++ static REQUEST reqst = { checkup_option, 0 }; ++ Input(&reqst, NULL); ++ return 0; ++} ++ ++/* Added GNU Readline Support -- Andrew Veliath */ ++void app_rl_readlines() ++{ ++ char *line, *expanded_line; ++ ++ strcpy(gnu_history_file, getenv("HOME")); ++ strcat(gnu_history_file, "/."); ++ strcat(gnu_history_file, application_name); ++ strcat(gnu_history_file, "_history"); ++ ++ using_history(); ++ read_history(gnu_history_file); ++ ++ rl_readline_name = application_name; ++ rl_instream = cp_in; ++ rl_outstream = cp_out; ++ rl_event_hook = rl_event_func; ++ ++ while (1) { ++ history_set_pos(history_length); ++ line = readline(prompt()); ++ if (line && *line) { ++ int s = history_expand(line, &expanded_line); ++ ++ if (s == 2) { ++ fprintf(stderr, "-> %s\n", expanded_line); ++ } else if (s == -1) { ++ fprintf(stderr, "readline: %s\n", expanded_line); ++ } else { ++ cp_evloop(expanded_line); ++ add_history(expanded_line); ++ } ++ free(expanded_line); ++ } ++ if (line) free(line); ++ else if (line == NULL) cp_evloop("quit"); ++ } ++ /* History gets written in ../fte/misccoms.c com_quit */ ++} ++#endif /* HAS_GNUREADLINE */ ++ + char *hlp_filelist[] = { "spice", 0 }; + + void +@@ -216,6 +322,10 @@ + + #endif + ++#ifdef __FreeBSD__ ++ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); ++#endif ++ + /* MFB tends to jump to 0 on errors. This tends to catch it. */ + if (started) { + fprintf(cp_err, "main: Internal Error: jump to zero\n"); +@@ -236,6 +346,13 @@ + ARCHsize = 1; + #endif /* PARALLEL_ARCH */ + ++#ifdef HAS_GNUREADLINE ++ if (!(application_name = strrchr(av[0],'/'))) ++ application_name = av[0]; ++ else ++ ++application_name; ++#endif ++ + #ifdef HAS_MAC_ARGCARGV + ac = initmac(&av); + #endif +@@ -472,7 +589,11 @@ + # ifdef HAS_UNIX_SIGS + /* Set up (void) signal handling */ + if (!ft_batchmode) { ++# ifdef HAS_GNUREADLINE ++ (void) signal(SIGINT, SIG_IGN); ++# else + (void) signal(SIGINT, ft_sigintr); ++# endif + (void) signal(SIGFPE, sigfloat); + # ifdef SIGTSTP + (void) signal(SIGTSTP, sigstop); +@@ -668,7 +789,11 @@ + } else { + (void) setjmp(jbuf); + cp_interactive = true; ++#ifdef HAS_GNUREADLINE ++ app_rl_readlines(); ++#else + while (cp_evloop((char *) NULL) == 1) ; ++#endif /* ifelse HAS_GNUREADLINE */ + } + + # else /* if BATCH */ +@@ -708,7 +833,11 @@ + /* Nutmeg "main" */ + (void) setjmp(jbuf); + cp_interactive = true; ++#ifdef HAS_GNUREADLINE ++ app_rl_readlines(); ++#else + while (cp_evloop((char *) NULL) == 1) ; ++#endif /* ifelse HAS_GNUREADLINE */ + + #endif + diff -uNr /usr/ports/cad/cider/files/patch-bc cider/files/patch-bc --- /usr/ports/cad/cider/files/patch-bc Sat Oct 28 17:13:06 2000 +++ cider/files/patch-bc Thu Sep 20 00:12:34 2001 @@ -1,213 +1,197 @@ -*** cider/common/src/bin/main.c.orig Sat Mar 12 08:20:59 1994 ---- cider/common/src/bin/main.c Tue Oct 24 03:37:38 2000 -*************** -*** 25,30 **** ---- 25,37 ---- - #include - #endif - -+ #ifdef HAS_GNUREADLINE -+ /* Added GNU Readline Support 11/3/97 -- Andrew Veliath */ -+ #include -+ #include -+ #include "fteinput.h" -+ #endif -+ - #ifdef HAS_UNIX_SIGS - #include - #endif -*************** -*** 36,41 **** ---- 43,53 ---- - #endif - - #include "patchlev.h" -+ -+ #ifdef __FreeBSD__ -+ #include -+ #endif -+ - #include "suffix.h" - - /* (Virtual) Machine architecture parameters */ -*************** -*** 53,58 **** ---- 65,75 ---- - bool ft_intrpt = false; /* Set by the (void) signal handlers. */ - bool ft_setflag = false; /* Don't abort after an interrupt. */ - -+ #ifdef HAS_GNUREADLINE -+ char gnu_history_file[512]; -+ static char *application_name; -+ #endif -+ - struct variable *(*if_getparam)( ); - - #ifdef BATCH -*************** -*** 185,190 **** ---- 202,294 ---- - - #endif - -+ #ifdef HAS_GNUREADLINE -+ /* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath */ -+ static char * -+ prompt() -+ { -+ static char pbuf[128]; -+ int n = sizeof(pbuf); -+ char *p = pbuf, *s; -+ -+ if (cp_interactive == false) -+ return; -+ if (cp_promptstring == NULL) -+ s = "-> "; -+ else -+ s = cp_promptstring; -+ if (cp_altprompt) -+ s = cp_altprompt; -+ while (*s && (n > 1)) { -+ int w; -+ switch (strip(*s)) { -+ case '!': -+ w = snprintf(p, n, "%d", where_history() + 1); -+ w = (w >= n) ? n - 1 : w; -+ p += w; -+ n -= w; -+ break; -+ default: -+ *p = strip(*s); ++p; -+ --n; -+ break; -+ } -+ s++; -+ } -+ *p = 0; -+ return pbuf; -+ } -+ -+ /* Process device events in Readline's hook since there is no where -+ else to do it now - AV */ -+ int rl_event_func() -+ { -+ static REQUEST reqst = { checkup_option, 0 }; -+ Input(&reqst, NULL); -+ return 0; -+ } -+ -+ /* Added GNU Readline Support -- Andrew Veliath */ -+ void app_rl_readlines() -+ { -+ char *line, *expanded_line; -+ -+ strcpy(gnu_history_file, getenv("HOME")); -+ strcat(gnu_history_file, "/."); -+ strcat(gnu_history_file, application_name); -+ strcat(gnu_history_file, "_history"); -+ -+ using_history(); -+ read_history(gnu_history_file); -+ -+ rl_readline_name = application_name; -+ rl_instream = cp_in; -+ rl_outstream = cp_out; -+ rl_event_hook = rl_event_func; -+ -+ while (1) { -+ history_set_pos(history_length); -+ line = readline(prompt()); -+ if (line && *line) { -+ int s = history_expand(line, &expanded_line); -+ -+ if (s == 2) { -+ fprintf(stderr, "-> %s\n", expanded_line); -+ } else if (s == -1) { -+ fprintf(stderr, "readline: %s\n", expanded_line); -+ } else { -+ cp_evloop(expanded_line); -+ add_history(expanded_line); -+ } -+ free(expanded_line); -+ } -+ if (line) free(line); -+ else if (line == NULL) cp_evloop("quit"); -+ } -+ /* History gets written in ../fte/misccoms.c com_quit */ -+ } -+ #endif /* HAS_GNUREADLINE */ -+ - char *hlp_filelist[] = { "spice", "cider", 0 }; - - void -*************** -*** 216,221 **** ---- 320,329 ---- - - #endif - -+ #ifdef __FreeBSD__ -+ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); -+ #endif -+ - /* MFB tends to jump to 0 on errors. This tends to catch it. */ - if (started) { - fprintf(cp_err, "main: Internal Error: jump to zero\n"); -*************** -*** 236,241 **** ---- 344,356 ---- - ARCHsize = 1; - #endif /* PARALLEL_ARCH */ - -+ #ifdef HAS_GNUREADLINE -+ if (!(application_name = strrchr(av[0],'/'))) -+ application_name = av[0]; -+ else -+ ++application_name; -+ #endif -+ - #ifdef HAS_MAC_ARGCARGV - ac = initmac(&av); - #endif -*************** -*** 472,478 **** ---- 587,597 ---- - # ifdef HAS_UNIX_SIGS - /* Set up (void) signal handling */ - if (!ft_batchmode) { -+ # ifdef HAS_GNUREADLINE -+ (void) signal(SIGINT, SIG_IGN); -+ # else - (void) signal(SIGINT, ft_sigintr); -+ # endif - (void) signal(SIGFPE, sigfloat); - # ifdef SIGTSTP - (void) signal(SIGTSTP, sigstop); -*************** -*** 668,674 **** ---- 787,797 ---- - } else { - (void) setjmp(jbuf); - cp_interactive = true; -+ #ifdef HAS_GNUREADLINE -+ app_rl_readlines(); -+ #else - while (cp_evloop((char *) NULL) == 1) ; -+ #endif /* ifelse HAS_GNUREADLINE */ - } - - # else /* if BATCH */ -*************** -*** 708,714 **** ---- 831,841 ---- - /* Nutmeg "main" */ - (void) setjmp(jbuf); - cp_interactive = true; -+ #ifdef HAS_GNUREADLINE -+ app_rl_readlines(); -+ #else - while (cp_evloop((char *) NULL) == 1) ; -+ #endif /* ifelse HAS_GNUREADLINE */ - - #endif - +--- cider/common/src/bin/main.c.orig Sat Mar 12 08:20:59 1994 ++++ cider/common/src/bin/main.c Wed Sep 19 11:07:47 2001 +@@ -25,6 +25,13 @@ + #include + #endif + ++#ifdef HAS_GNUREADLINE ++/* Added GNU Readline Support 11/3/97 -- Andrew Veliath */ ++#include ++#include ++#include "fteinput.h" ++#endif ++ + #ifdef HAS_UNIX_SIGS + #include + #endif +@@ -36,6 +43,11 @@ + #endif + + #include "patchlev.h" ++ ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include "suffix.h" + + /* (Virtual) Machine architecture parameters */ +@@ -53,6 +65,11 @@ + bool ft_intrpt = false; /* Set by the (void) signal handlers. */ + bool ft_setflag = false; /* Don't abort after an interrupt. */ + ++#ifdef HAS_GNUREADLINE ++char gnu_history_file[512]; ++static char *application_name; ++#endif ++ + struct variable *(*if_getparam)( ); + + #ifdef BATCH +@@ -185,6 +202,95 @@ + + #endif + ++#ifdef HAS_GNUREADLINE ++/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath */ ++static char * ++prompt() ++{ ++ static char pbuf[128]; ++ int n = sizeof(pbuf); ++ char *p = pbuf, *s; ++ ++ if (cp_interactive == false) ++ return; ++ if (cp_promptstring == NULL) ++ s = "-> "; ++ else ++ s = cp_promptstring; ++ if (cp_altprompt) ++ s = cp_altprompt; ++ while (*s && (n > 1)) { ++ int w; ++ switch (strip(*s)) { ++ case '!': ++ w = snprintf(p, n, "%d", where_history() + 1); ++ w = (w >= n) ? n - 1 : w; ++ p += w; ++ n -= w; ++ break; ++ case '\\': ++ if (*(s + 1)) ++s; ++ default: ++ *p = strip(*s); ++p; ++ --n; ++ break; ++ } ++ s++; ++ } ++ *p = 0; ++ return pbuf; ++} ++ ++/* Process device events in Readline's hook since there is no where ++ else to do it now - AV */ ++int rl_event_func() ++{ ++ static REQUEST reqst = { checkup_option, 0 }; ++ Input(&reqst, NULL); ++ return 0; ++} ++ ++/* Added GNU Readline Support -- Andrew Veliath */ ++void app_rl_readlines() ++{ ++ char *line, *expanded_line; ++ ++ strcpy(gnu_history_file, getenv("HOME")); ++ strcat(gnu_history_file, "/."); ++ strcat(gnu_history_file, application_name); ++ strcat(gnu_history_file, "_history"); ++ ++ using_history(); ++ read_history(gnu_history_file); ++ ++ rl_readline_name = application_name; ++ rl_instream = cp_in; ++ rl_outstream = cp_out; ++ rl_event_hook = rl_event_func; ++ ++ while (1) { ++ history_set_pos(history_length); ++ line = readline(prompt()); ++ if (line && *line) { ++ int s = history_expand(line, &expanded_line); ++ ++ if (s == 2) { ++ fprintf(stderr, "-> %s\n", expanded_line); ++ } else if (s == -1) { ++ fprintf(stderr, "readline: %s\n", expanded_line); ++ } else { ++ cp_evloop(expanded_line); ++ add_history(expanded_line); ++ } ++ free(expanded_line); ++ } ++ if (line) free(line); ++ else if (line == NULL) cp_evloop("quit"); ++ } ++ /* History gets written in ../fte/misccoms.c com_quit */ ++} ++#endif /* HAS_GNUREADLINE */ ++ + char *hlp_filelist[] = { "spice", "cider", 0 }; + + void +@@ -216,6 +322,10 @@ + + #endif + ++#ifdef __FreeBSD__ ++ fpsetmask(fpgetmask() & ~FP_X_INV & ~FP_X_DZ & ~FP_X_OFL); ++#endif ++ + /* MFB tends to jump to 0 on errors. This tends to catch it. */ + if (started) { + fprintf(cp_err, "main: Internal Error: jump to zero\n"); +@@ -236,6 +346,13 @@ + ARCHsize = 1; + #endif /* PARALLEL_ARCH */ + ++#ifdef HAS_GNUREADLINE ++ if (!(application_name = strrchr(av[0],'/'))) ++ application_name = av[0]; ++ else ++ ++application_name; ++#endif ++ + #ifdef HAS_MAC_ARGCARGV + ac = initmac(&av); + #endif +@@ -472,7 +589,11 @@ + # ifdef HAS_UNIX_SIGS + /* Set up (void) signal handling */ + if (!ft_batchmode) { ++# ifdef HAS_GNUREADLINE ++ (void) signal(SIGINT, SIG_IGN); ++# else + (void) signal(SIGINT, ft_sigintr); ++# endif + (void) signal(SIGFPE, sigfloat); + # ifdef SIGTSTP + (void) signal(SIGTSTP, sigstop); +@@ -668,7 +789,11 @@ + } else { + (void) setjmp(jbuf); + cp_interactive = true; ++#ifdef HAS_GNUREADLINE ++ app_rl_readlines(); ++#else + while (cp_evloop((char *) NULL) == 1) ; ++#endif /* ifelse HAS_GNUREADLINE */ + } + + # else /* if BATCH */ +@@ -708,7 +833,11 @@ + /* Nutmeg "main" */ + (void) setjmp(jbuf); + cp_interactive = true; ++#ifdef HAS_GNUREADLINE ++ app_rl_readlines(); ++#else + while (cp_evloop((char *) NULL) == 1) ; ++#endif /* ifelse HAS_GNUREADLINE */ + + #endif + >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message