summaryrefslogtreecommitdiffstats
path: root/bin/sh/histedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/histedit.c')
-rw-r--r--bin/sh/histedit.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 9cf8a23..56f4d02 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -33,26 +33,33 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: histedit.c,v 1.3 1995/05/05 06:34:13 davidg Exp $
+ * $Id: histedit.c,v 1.4 1995/05/30 00:07:14 rgrimes Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)histedit.c 8.1 (Berkeley) 5/31/93";
+static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95";
#endif /* not lint */
-/*
- * Editline and history functions (and glue).
- */
#include <sys/param.h>
#include <paths.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+/*
+ * Editline and history functions (and glue).
+ */
#include "shell.h"
#include "parser.h"
#include "var.h"
#include "options.h"
+#include "main.h"
+#include "output.h"
#include "mystring.h"
+#ifndef NO_HISTORY
+#include "myhistedit.h"
+#endif
#include "error.h"
-#include "histedit.h"
+#include "eval.h"
#include "memalloc.h"
#define MAXHISTLOOPS 4 /* max recursions through fc */
@@ -69,7 +76,9 @@ STATIC char *fc_replace __P((const char *, char *, char *));
* Set history and editing status. Called whenever the status may
* have changed (figures out what to do).
*/
-histedit() {
+void
+histedit()
+{
#define editing (Eflag || Vflag)
@@ -134,7 +143,10 @@ bad:
}
}
-sethistsize() {
+
+void
+sethistsize()
+{
char *cp;
int histsize;
@@ -151,8 +163,10 @@ sethistsize() {
* This command is provided since POSIX decided to standardize
* the Korn shell fc command. Oh well...
*/
+int
histcmd(argc, argv)
- char *argv[];
+ int argc;
+ char **argv;
{
extern char *optarg;
extern int optind, optopt, optreset;
@@ -169,6 +183,21 @@ histcmd(argc, argv)
struct jmploc *volatile savehandler;
char editfile[MAXPATHLEN + 1];
FILE *efp;
+#ifdef __GNUC__
+ /* Avoid longjmp clobbering */
+ (void) &editor;
+ (void) &lflg;
+ (void) &nflg;
+ (void) &rflg;
+ (void) &sflg;
+ (void) &firststr;
+ (void) &laststr;
+ (void) &pat;
+ (void) &repl;
+ (void) &efp;
+ (void) &argc;
+ (void) &argv;
+#endif
if (hist == NULL)
error("history not active");
@@ -360,6 +389,7 @@ histcmd(argc, argv)
--active;
if (displayhist)
displayhist = 0;
+ return 0;
}
STATIC char *
@@ -386,6 +416,7 @@ fc_replace(s, p, r)
return (dest);
}
+int
not_fcnumber(s)
char *s;
{
@@ -398,6 +429,7 @@ not_fcnumber(s)
return (!is_number(s));
}
+int
str_to_event(str, last)
char *str;
int last;
@@ -405,7 +437,7 @@ str_to_event(str, last)
const HistEvent *he;
char *s = str;
int relative = 0;
- int i, j;
+ int i;
he = history(hist, H_FIRST);
switch (*s) {
OpenPOWER on IntegriCloud