*** empty log message ***
This commit is contained in:
parent
3c19577344
commit
757eeda04b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=84261
@ -70,7 +70,7 @@ static const char rcsid[] =
|
|||||||
History *hist; /* history cookie */
|
History *hist; /* history cookie */
|
||||||
EditLine *el; /* editline cookie */
|
EditLine *el; /* editline cookie */
|
||||||
int displayhist;
|
int displayhist;
|
||||||
static FILE *el_in, *el_out;
|
static FILE *el_in, *el_out, *el_err;
|
||||||
|
|
||||||
STATIC char *fc_replace __P((const char *, char *, char *));
|
STATIC char *fc_replace __P((const char *, char *, char *));
|
||||||
|
|
||||||
@ -105,11 +105,13 @@ histedit()
|
|||||||
INTOFF;
|
INTOFF;
|
||||||
if (el_in == NULL)
|
if (el_in == NULL)
|
||||||
el_in = fdopen(0, "r");
|
el_in = fdopen(0, "r");
|
||||||
|
if (el_err == NULL)
|
||||||
|
el_err = fdopen(1, "w");
|
||||||
if (el_out == NULL)
|
if (el_out == NULL)
|
||||||
el_out = fdopen(2, "w");
|
el_out = fdopen(2, "w");
|
||||||
if (el_in == NULL || el_out == NULL)
|
if (el_in == NULL || el_err == NULL || el_out == NULL)
|
||||||
goto bad;
|
goto bad;
|
||||||
el = el_init(arg0, el_in, el_out);
|
el = el_init(arg0, el_in, el_out, el_err);
|
||||||
if (el != NULL) {
|
if (el != NULL) {
|
||||||
if (hist)
|
if (hist)
|
||||||
el_set(el, EL_HIST, history, hist);
|
el_set(el, EL_HIST, history, hist);
|
||||||
@ -151,12 +153,13 @@ sethistsize(hs)
|
|||||||
const char *hs;
|
const char *hs;
|
||||||
{
|
{
|
||||||
int histsize;
|
int histsize;
|
||||||
|
HistEvent he;
|
||||||
|
|
||||||
if (hist != NULL) {
|
if (hist != NULL) {
|
||||||
if (hs == NULL || *hs == '\0' ||
|
if (hs == NULL || *hs == '\0' ||
|
||||||
(histsize = atoi(hs)) < 0)
|
(histsize = atoi(hs)) < 0)
|
||||||
histsize = 100;
|
histsize = 100;
|
||||||
history(hist, H_EVENT, histsize);
|
history(hist, &he, H_EVENT, histsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,9 +174,9 @@ histcmd(argc, argv)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *editor = NULL;
|
char *editor = NULL;
|
||||||
const HistEvent *he;
|
HistEvent he;
|
||||||
int lflg = 0, nflg = 0, rflg = 0, sflg = 0;
|
int lflg = 0, nflg = 0, rflg = 0, sflg = 0;
|
||||||
int i;
|
int i, retval;
|
||||||
char *firststr, *laststr;
|
char *firststr, *laststr;
|
||||||
int first, last, direction;
|
int first, last, direction;
|
||||||
char *pat = NULL, *repl; /* ksh "fc old=new" crap */
|
char *pat = NULL, *repl; /* ksh "fc old=new" crap */
|
||||||
@ -339,16 +342,16 @@ histcmd(argc, argv)
|
|||||||
* The history interface needs rethinking, as the following
|
* The history interface needs rethinking, as the following
|
||||||
* convolutions will demonstrate.
|
* convolutions will demonstrate.
|
||||||
*/
|
*/
|
||||||
history(hist, H_FIRST);
|
history(hist, &he, H_FIRST);
|
||||||
he = history(hist, H_NEXT_EVENT, first);
|
retval = history(hist, &he, H_NEXT_EVENT, first);
|
||||||
for (;he != NULL; he = history(hist, direction)) {
|
for (;retval != -1; retval = history(hist, &he, direction)) {
|
||||||
if (lflg) {
|
if (lflg) {
|
||||||
if (!nflg)
|
if (!nflg)
|
||||||
out1fmt("%5d ", he->num);
|
out1fmt("%5d ", he.num);
|
||||||
out1str(he->str);
|
out1str(he.str);
|
||||||
} else {
|
} else {
|
||||||
char *s = pat ?
|
char *s = pat ?
|
||||||
fc_replace(he->str, pat, repl) : (char *)he->str;
|
fc_replace(he.str, pat, repl) : (char *)he.str;
|
||||||
|
|
||||||
if (sflg) {
|
if (sflg) {
|
||||||
if (displayhist) {
|
if (displayhist) {
|
||||||
@ -360,7 +363,7 @@ histcmd(argc, argv)
|
|||||||
* XXX what about recursive and
|
* XXX what about recursive and
|
||||||
* relative histnums.
|
* relative histnums.
|
||||||
*/
|
*/
|
||||||
history(hist, H_ENTER, s);
|
history(hist, &he, H_ENTER, s);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fputs(s, efp);
|
fputs(s, efp);
|
||||||
@ -369,7 +372,7 @@ histcmd(argc, argv)
|
|||||||
* At end? (if we were to loose last, we'd sure be
|
* At end? (if we were to loose last, we'd sure be
|
||||||
* messed up).
|
* messed up).
|
||||||
*/
|
*/
|
||||||
if (he->num == last)
|
if (he.num == last)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (editor) {
|
if (editor) {
|
||||||
@ -431,12 +434,12 @@ str_to_event(str, last)
|
|||||||
char *str;
|
char *str;
|
||||||
int last;
|
int last;
|
||||||
{
|
{
|
||||||
const HistEvent *he;
|
HistEvent he;
|
||||||
char *s = str;
|
char *s = str;
|
||||||
int relative = 0;
|
int relative = 0;
|
||||||
int i;
|
int i, retval;
|
||||||
|
|
||||||
he = history(hist, H_FIRST);
|
retval = history(hist, &he, H_FIRST);
|
||||||
switch (*s) {
|
switch (*s) {
|
||||||
case '-':
|
case '-':
|
||||||
relative = 1;
|
relative = 1;
|
||||||
@ -447,33 +450,33 @@ str_to_event(str, last)
|
|||||||
if (is_number(s)) {
|
if (is_number(s)) {
|
||||||
i = atoi(s);
|
i = atoi(s);
|
||||||
if (relative) {
|
if (relative) {
|
||||||
while (he != NULL && i--) {
|
while (retval != -1 && i--) {
|
||||||
he = history(hist, H_NEXT);
|
retval = history(hist, &he, H_NEXT);
|
||||||
}
|
}
|
||||||
if (he == NULL)
|
if (retval == -1)
|
||||||
he = history(hist, H_LAST);
|
retval = history(hist, &he, H_LAST);
|
||||||
} else {
|
} else {
|
||||||
he = history(hist, H_NEXT_EVENT, i);
|
retval = history(hist, &he, H_NEXT_EVENT, i);
|
||||||
if (he == NULL) {
|
if (retval == -1) {
|
||||||
/*
|
/*
|
||||||
* the notion of first and last is
|
* the notion of first and last is
|
||||||
* backwards to that of the history package
|
* backwards to that of the history package
|
||||||
*/
|
*/
|
||||||
he = history(hist, last ? H_FIRST : H_LAST);
|
retval = history(hist, &he, last ? H_FIRST : H_LAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (he == NULL)
|
if (retval == -1)
|
||||||
error("history number %s not found (internal error)",
|
error("history number %s not found (internal error)",
|
||||||
str);
|
str);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* pattern
|
* pattern
|
||||||
*/
|
*/
|
||||||
he = history(hist, H_PREV_STR, str);
|
retval = history(hist, &he, H_PREV_STR, str);
|
||||||
if (he == NULL)
|
if (retval == -1)
|
||||||
error("history pattern not found: %s", str);
|
error("history pattern not found: %s", str);
|
||||||
}
|
}
|
||||||
return (he->num);
|
return (he.num);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
@ -292,8 +292,10 @@ preadbuffer()
|
|||||||
|
|
||||||
#ifndef NO_HISTORY
|
#ifndef NO_HISTORY
|
||||||
if (parsefile->fd == 0 && hist && something) {
|
if (parsefile->fd == 0 && hist && something) {
|
||||||
|
HistEvent he;
|
||||||
INTOFF;
|
INTOFF;
|
||||||
history(hist, whichprompt == 1 ? H_ENTER : H_ADD, parsenextc);
|
history(hist, &he, whichprompt == 1 ? H_ENTER : H_ADD,
|
||||||
|
parsenextc);
|
||||||
INTON;
|
INTON;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,14 +125,15 @@ nslookup_yy_input(buf, result, max_size, intr)
|
|||||||
{
|
{
|
||||||
static EditLine *el = NULL;
|
static EditLine *el = NULL;
|
||||||
static History *hist = NULL;
|
static History *hist = NULL;
|
||||||
|
HistEvent he;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
const char *bp = NULL;
|
const char *bp = NULL;
|
||||||
|
|
||||||
if (intr) {
|
if (intr) {
|
||||||
if (!el) {
|
if (!el) {
|
||||||
el = el_init("nslookup", yyin, yyout);
|
el = el_init("nslookup", yyin, yyout, stderr);
|
||||||
hist = history_init();
|
hist = history_init();
|
||||||
history(hist, H_EVENT, 100);
|
history(hist, &he, H_EVENT, 100);
|
||||||
el_set(el, EL_HIST, history, hist);
|
el_set(el, EL_HIST, history, hist);
|
||||||
el_set(el, EL_EDITOR, "emacs");
|
el_set(el, EL_EDITOR, "emacs");
|
||||||
el_set(el, EL_PROMPT, nslookup_prompt);
|
el_set(el, EL_PROMPT, nslookup_prompt);
|
||||||
@ -147,7 +148,7 @@ nslookup_yy_input(buf, result, max_size, intr)
|
|||||||
|
|
||||||
*result = (num > max_size) ? max_size : num;
|
*result = (num > max_size) ? max_size : num;
|
||||||
strncpy(buf, bp, *result);
|
strncpy(buf, bp, *result);
|
||||||
history(hist, H_ENTER, bp);
|
history(hist, &he, H_ENTER, bp);
|
||||||
} else {
|
} else {
|
||||||
if ( ((*result = fread( buf, 1, max_size, yyin )) == 0)
|
if ( ((*result = fread( buf, 1, max_size, yyin )) == 0)
|
||||||
&& ferror( yyin ) )
|
&& ferror( yyin ) )
|
||||||
|
@ -107,6 +107,7 @@ copies:
|
|||||||
rm -f ${DESTDIR}/usr/include/$i; \
|
rm -f ${DESTDIR}/usr/include/$i; \
|
||||||
fi
|
fi
|
||||||
.endfor
|
.endfor
|
||||||
|
install -d -o ${BINOWN} -g ${BINGRP} -m 755 ${DESTDIR}/usr/include
|
||||||
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
|
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
|
||||||
-p ${DESTDIR}/usr/include
|
-p ${DESTDIR}/usr/include
|
||||||
.for i in ${LDIRS} ${LSUBDIRS}
|
.for i in ${LDIRS} ${LSUBDIRS}
|
||||||
|
@ -220,15 +220,16 @@ cmdloop()
|
|||||||
struct cmdtable *cmdp;
|
struct cmdtable *cmdp;
|
||||||
History *hist;
|
History *hist;
|
||||||
EditLine *elptr;
|
EditLine *elptr;
|
||||||
|
HistEvent he;
|
||||||
|
|
||||||
curinode = ginode(ROOTINO);
|
curinode = ginode(ROOTINO);
|
||||||
curinum = ROOTINO;
|
curinum = ROOTINO;
|
||||||
printactive();
|
printactive();
|
||||||
|
|
||||||
hist = history_init();
|
hist = history_init();
|
||||||
history(hist, H_EVENT, 100); /* 100 elt history buffer */
|
history(hist, &he, H_EVENT, 100); /* 100 elt history buffer */
|
||||||
|
|
||||||
elptr = el_init("fsdb", stdin, stdout);
|
elptr = el_init("fsdb", stdin, stdout, stderr);
|
||||||
el_set(elptr, EL_EDITOR, "emacs");
|
el_set(elptr, EL_EDITOR, "emacs");
|
||||||
el_set(elptr, EL_PROMPT, prompt);
|
el_set(elptr, EL_PROMPT, prompt);
|
||||||
el_set(elptr, EL_HIST, history, hist);
|
el_set(elptr, EL_HIST, history, hist);
|
||||||
@ -238,7 +239,7 @@ cmdloop()
|
|||||||
if (debug)
|
if (debug)
|
||||||
printf("command `%s'\n", elline);
|
printf("command `%s'\n", elline);
|
||||||
|
|
||||||
history(hist, H_ENTER, elline);
|
history(hist, &he, H_ENTER, elline);
|
||||||
|
|
||||||
line = strdup(elline);
|
line = strdup(elline);
|
||||||
cmd_argv = crack(line, &cmd_argc);
|
cmd_argv = crack(line, &cmd_argc);
|
||||||
|
@ -1098,6 +1098,7 @@ input (int *cmd)
|
|||||||
#define MAXLINE 80
|
#define MAXLINE 80
|
||||||
static EditLine *el = NULL;
|
static EditLine *el = NULL;
|
||||||
static History *hist = NULL;
|
static History *hist = NULL;
|
||||||
|
HistEvent he;
|
||||||
static char buf[MAXLINE];
|
static char buf[MAXLINE];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
int len;
|
int len;
|
||||||
@ -1107,9 +1108,10 @@ input (int *cmd)
|
|||||||
do {
|
do {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
if (!el) {
|
if (!el) {
|
||||||
el = el_init("cdcontrol", stdin, stdout);
|
el = el_init("cdcontrol", stdin, stdout,
|
||||||
|
stderr);
|
||||||
hist = history_init();
|
hist = history_init();
|
||||||
history(hist, H_EVENT, 100);
|
history(hist, &he, H_EVENT, 100);
|
||||||
el_set(el, EL_HIST, history, hist);
|
el_set(el, EL_HIST, history, hist);
|
||||||
el_set(el, EL_EDITOR, "emacs");
|
el_set(el, EL_EDITOR, "emacs");
|
||||||
el_set(el, EL_PROMPT, cdcontrol_prompt);
|
el_set(el, EL_PROMPT, cdcontrol_prompt);
|
||||||
@ -1125,7 +1127,7 @@ input (int *cmd)
|
|||||||
len = (num > MAXLINE) ? MAXLINE : num;
|
len = (num > MAXLINE) ? MAXLINE : num;
|
||||||
memcpy(buf, bp, len);
|
memcpy(buf, bp, len);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
history(hist, H_ENTER, bp);
|
history(hist, &he, H_ENTER, bp);
|
||||||
#undef MAXLINE
|
#undef MAXLINE
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,6 +150,7 @@ cmdscanner(void)
|
|||||||
register struct cmd *c;
|
register struct cmd *c;
|
||||||
static EditLine *el;
|
static EditLine *el;
|
||||||
static History *hist;
|
static History *hist;
|
||||||
|
HistEvent he;
|
||||||
size_t len;
|
size_t len;
|
||||||
int num;
|
int num;
|
||||||
const char *bp;
|
const char *bp;
|
||||||
@ -161,9 +162,9 @@ cmdscanner(void)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
if (fromatty) {
|
if (fromatty) {
|
||||||
if (!el) {
|
if (!el) {
|
||||||
el = el_init("lpc", stdin, stdout);
|
el = el_init("lpc", stdin, stdout, stderr);
|
||||||
hist = history_init();
|
hist = history_init();
|
||||||
history(hist, H_EVENT, 100);
|
history(hist, &he, H_EVENT, 100);
|
||||||
el_set(el, EL_HIST, history, hist);
|
el_set(el, EL_HIST, history, hist);
|
||||||
el_set(el, EL_EDITOR, "emacs");
|
el_set(el, EL_EDITOR, "emacs");
|
||||||
el_set(el, EL_PROMPT, lpc_prompt);
|
el_set(el, EL_PROMPT, lpc_prompt);
|
||||||
@ -185,7 +186,7 @@ cmdscanner(void)
|
|||||||
len = (num > MAX_CMDLINE) ? MAX_CMDLINE : num;
|
len = (num > MAX_CMDLINE) ? MAX_CMDLINE : num;
|
||||||
memcpy(cmdline, bp, len);
|
memcpy(cmdline, bp, len);
|
||||||
cmdline[len] = 0;
|
cmdline[len] = 0;
|
||||||
history(hist, H_ENTER, bp);
|
history(hist, &he, H_ENTER, bp);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (fgets(cmdline, MAX_CMDLINE, stdin) == 0)
|
if (fgets(cmdline, MAX_CMDLINE, stdin) == 0)
|
||||||
|
@ -273,7 +273,7 @@ Terminal(void *v)
|
|||||||
struct thread_data *td;
|
struct thread_data *td;
|
||||||
const char *l;
|
const char *l;
|
||||||
int len;
|
int len;
|
||||||
#ifdef __NetBSD__
|
#ifndef __OpenBSD__
|
||||||
HistEvent hev = { 0, "" };
|
HistEvent hev = { 0, "" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -287,10 +287,10 @@ Terminal(void *v)
|
|||||||
|
|
||||||
while ((l = SmartGets(td->edit, &len, td->ppp))) {
|
while ((l = SmartGets(td->edit, &len, td->ppp))) {
|
||||||
if (len > 1)
|
if (len > 1)
|
||||||
#ifdef __NetBSD__
|
#ifdef __OpenBSD__
|
||||||
history(td->hist, &hev, H_ENTER, l);
|
|
||||||
#else
|
|
||||||
history(td->hist, H_ENTER, l);
|
history(td->hist, H_ENTER, l);
|
||||||
|
#else
|
||||||
|
history(td->hist, &hev, H_ENTER, l);
|
||||||
#endif
|
#endif
|
||||||
write(td->ppp, l, len);
|
write(td->ppp, l, len);
|
||||||
if (Receive(td->ppp, REC_SHOW) != 0)
|
if (Receive(td->ppp, REC_SHOW) != 0)
|
||||||
@ -543,7 +543,7 @@ main(int argc, char **argv)
|
|||||||
struct thread_data td;
|
struct thread_data td;
|
||||||
const char *env;
|
const char *env;
|
||||||
int size;
|
int size;
|
||||||
#ifdef __NetBSD__
|
#ifndef __OpenBSD__
|
||||||
HistEvent hev = { 0, "" };
|
HistEvent hev = { 0, "" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -554,12 +554,12 @@ main(int argc, char **argv)
|
|||||||
size = 20;
|
size = 20;
|
||||||
} else
|
} else
|
||||||
size = 20;
|
size = 20;
|
||||||
#ifdef __NetBSD__
|
#ifdef __OpenBSD__
|
||||||
history(td.hist, &hev, H_SETSIZE, size);
|
|
||||||
td.edit = el_init("pppctl", stdin, stdout, stderr);
|
|
||||||
#else
|
|
||||||
history(td.hist, H_EVENT, size);
|
history(td.hist, H_EVENT, size);
|
||||||
td.edit = el_init("pppctl", stdin, stdout);
|
td.edit = el_init("pppctl", stdin, stdout);
|
||||||
|
#else
|
||||||
|
history(td.hist, &hev, H_SETSIZE, size);
|
||||||
|
td.edit = el_init("pppctl", stdin, stdout, stderr);
|
||||||
#endif
|
#endif
|
||||||
el_source(td.edit, NULL);
|
el_source(td.edit, NULL);
|
||||||
el_set(td.edit, EL_PROMPT, GetPrompt);
|
el_set(td.edit, EL_PROMPT, GetPrompt);
|
||||||
|
Loading…
Reference in New Issue
Block a user