summaryrefslogtreecommitdiffstats
path: root/bin/sh/histedit.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
committerpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
commit5195be912eb257c05a0c97e561e72f01af2583ff (patch)
treee47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/histedit.c
parent2fc7d7d1fa299368ccdddede67b31695266698bd (diff)
downloadFreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.zip
FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.tar.gz
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
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