2011-03-24 22:19:15 +00:00
|
|
|
diff -durp libedit-20110227-3.0.orig/examples/fileman.c libedit-20110227-3.0/examples/fileman.c
|
|
|
|
--- libedit-20110227-3.0.orig/examples/fileman.c 2010-04-22 13:13:17.000000000 -0600
|
|
|
|
+++ libedit-20110227-3.0/examples/fileman.c 2011-03-24 15:48:02.492809146 -0600
|
2011-02-08 05:04:21 +00:00
|
|
|
@@ -279,7 +279,7 @@ command_generator (text, state)
|
2010-03-30 11:36:44 +00:00
|
|
|
|
|
|
|
/* Return the next name which partially matches from the
|
|
|
|
command list. */
|
|
|
|
- while (name = commands[list_index].name)
|
|
|
|
+ while ((name = commands[list_index].name))
|
|
|
|
{
|
|
|
|
list_index++;
|
|
|
|
|
2011-03-24 22:19:15 +00:00
|
|
|
diff -durp libedit-20110227-3.0.orig/examples/wtc1.c libedit-20110227-3.0/examples/wtc1.c
|
|
|
|
--- libedit-20110227-3.0.orig/examples/wtc1.c 2010-04-22 13:13:17.000000000 -0600
|
|
|
|
+++ libedit-20110227-3.0/examples/wtc1.c 2011-03-24 15:48:02.493809075 -0600
|
2011-02-08 05:04:21 +00:00
|
|
|
@@ -60,7 +60,7 @@ complete(EditLine *el, int ch)
|
|
|
|
char *buf, *bptr;
|
|
|
|
const LineInfoW *lf = el_wline(el);
|
|
|
|
int len, mblen, i;
|
|
|
|
- unsigned char res;
|
|
|
|
+ unsigned char res = CC_NORM;
|
|
|
|
|
|
|
|
/* Find the last word */
|
|
|
|
for (ptr = lf->cursor -1; !iswspace(*ptr) && ptr > lf->buffer; --ptr)
|
2011-03-24 22:19:15 +00:00
|
|
|
diff -durp libedit-20110227-3.0.orig/src/readline.c libedit-20110227-3.0/src/readline.c
|
|
|
|
--- libedit-20110227-3.0.orig/src/readline.c 2011-02-26 15:42:59.000000000 -0700
|
|
|
|
+++ libedit-20110227-3.0/src/readline.c 2011-03-24 15:48:02.500808588 -0600
|
|
|
|
@@ -1280,8 +1280,8 @@ history_truncate_file (const char *filen
|
2010-03-30 11:36:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fflush(fp);
|
|
|
|
- if((off = ftello(fp)) > 0)
|
|
|
|
- (void)ftruncate(fileno(fp), off);
|
2011-02-08 05:04:21 +00:00
|
|
|
+ if((off = ftello(fp)) > 0 && ftruncate(fileno(fp), off) < 0)
|
|
|
|
+ ret = errno;
|
2010-03-30 11:36:44 +00:00
|
|
|
out3:
|
|
|
|
fclose(tp);
|
|
|
|
out2:
|
2011-03-24 22:19:15 +00:00
|
|
|
diff -durp libedit-20110227-3.0.orig/src/vi.c libedit-20110227-3.0/src/vi.c
|
|
|
|
--- libedit-20110227-3.0.orig/src/vi.c 2011-02-26 15:42:59.000000000 -0700
|
|
|
|
+++ libedit-20110227-3.0/src/vi.c 2011-03-24 15:48:02.501808516 -0600
|
|
|
|
@@ -1009,6 +1009,7 @@ vi_histedit(EditLine *el, Int c)
|
2010-03-30 11:36:44 +00:00
|
|
|
char *cp;
|
2011-02-08 05:04:21 +00:00
|
|
|
size_t len;
|
|
|
|
Char *line;
|
2010-03-30 11:36:44 +00:00
|
|
|
+ el_action_t rv = CC_ERROR;
|
|
|
|
|
|
|
|
if (el->el_state.doingarg) {
|
|
|
|
if (vi_to_history_line(el, 0) == CC_ERROR)
|
2011-03-24 22:19:15 +00:00
|
|
|
@@ -1036,16 +1037,14 @@ vi_histedit(EditLine *el, Int c)
|
2011-02-08 05:04:21 +00:00
|
|
|
ct_wcstombs(cp, line, TMP_BUFSIZ - 1);
|
|
|
|
cp[TMP_BUFSIZ - 1] = '\0';
|
|
|
|
len = strlen(cp);
|
|
|
|
- write(fd, cp, len);
|
2010-03-30 11:36:44 +00:00
|
|
|
- write(fd, "\n", 1);
|
2011-02-08 05:04:21 +00:00
|
|
|
+ if (write(fd, cp, len) < 0 || write(fd, "\n", 1) < 0)
|
2010-03-30 11:36:44 +00:00
|
|
|
+ /* FIXME: handle EAGAIN somehow? */
|
|
|
|
+ goto fail;
|
|
|
|
+
|
|
|
|
pid = fork();
|
|
|
|
switch (pid) {
|
|
|
|
case -1:
|
|
|
|
- close(fd);
|
|
|
|
- unlink(tempfile);
|
2011-02-08 05:04:21 +00:00
|
|
|
- el_free(cp);
|
|
|
|
- el_free(line);
|
2010-03-30 11:36:44 +00:00
|
|
|
- return CC_ERROR;
|
|
|
|
+ goto fail;
|
|
|
|
case 0:
|
|
|
|
close(fd);
|
|
|
|
execlp("vi", "vi", tempfile, (char *)NULL);
|
2011-03-24 22:19:15 +00:00
|
|
|
@@ -1067,15 +1066,17 @@ vi_histedit(EditLine *el, Int c)
|
2011-02-08 05:04:21 +00:00
|
|
|
len = 0;
|
|
|
|
el->el_line.cursor = el->el_line.buffer;
|
|
|
|
el->el_line.lastchar = el->el_line.buffer + len;
|
|
|
|
- el_free(cp);
|
|
|
|
- el_free(line);
|
2010-03-30 11:36:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* return CC_REFRESH; */
|
|
|
|
+ rv = ed_newline(el, 0);
|
|
|
|
+fail:
|
|
|
|
close(fd);
|
|
|
|
unlink(tempfile);
|
|
|
|
- /* return CC_REFRESH; */
|
|
|
|
- return ed_newline(el, 0);
|
2011-02-08 05:04:21 +00:00
|
|
|
+ el_free(cp);
|
|
|
|
+ el_free(line);
|
2010-03-30 11:36:44 +00:00
|
|
|
+ return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vi_history_word():
|