From 52edeba1946a33d6c6c297b111b70f5ae7dc50b1 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Mon, 7 Feb 2011 22:04:21 -0700 Subject: [PATCH] * Mon Feb 7 2011 Jerry James - 3.0-2.20100424cvs - Update to 3.0 (20100424 snap) - Enable wide-character (Unicode) support --- .gitignore | 2 +- libedit-3.0-sigwinch.patch | 6 +-- libedit-3.0-warnings.patch | 86 +++++++++++++++++++------------------- libedit.spec | 12 +++--- sources | 2 +- 5 files changed, 56 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 4e10fc6..4f24f2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -libedit-20090923-3.0.tar.gz +libedit-20100424-3.0.tar.gz diff --git a/libedit-3.0-sigwinch.patch b/libedit-3.0-sigwinch.patch index c9e63c2..088503d 100644 --- a/libedit-3.0-sigwinch.patch +++ b/libedit-3.0-sigwinch.patch @@ -1,6 +1,6 @@ ---- libedit-20090923-3.0/src/read.c.sigwinch 2009-09-23 22:04:26.000000000 +0100 -+++ libedit-20090923-3.0/src/read.c 2010-03-19 20:47:46.000000000 +0000 -@@ -301,6 +301,9 @@ read_char(EditLine *el, char *cp) +--- libedit-20100424-3.0/src/read.c.sigwinch 2010-04-22 14:09:52.000000000 -0600 ++++ libedit-20100424-3.0/src/read.c 2011-02-05 18:16:19.007277633 -0700 +@@ -325,6 +325,9 @@ sig_set(el); el_set(el, EL_REFRESH); goto again; diff --git a/libedit-3.0-warnings.patch b/libedit-3.0-warnings.patch index c9e23a0..52add48 100644 --- a/libedit-3.0-warnings.patch +++ b/libedit-3.0-warnings.patch @@ -1,21 +1,7 @@ - examples/fileman.c | 3 ++- - src/readline.c | 6 ++++-- - src/vi.c | 18 +++++++++++------- - 3 files changed, 17 insertions(+), 10 deletions(-) - -diff --git a/examples/fileman.c b/examples/fileman.c -index f1d81af..026a4f4 100644 ---- a/examples/fileman.c -+++ b/examples/fileman.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - /* GNU readline - #include -@@ -275,7 +276,7 @@ command_generator (text, state) +diff -durp libedit-20100424-3.0.orig/examples/fileman.c libedit-20100424-3.0/examples/fileman.c +--- libedit-20100424-3.0.orig/examples/fileman.c 2010-04-22 13:13:17.000000000 -0600 ++++ libedit-20100424-3.0/examples/fileman.c 2011-02-07 13:14:13.209553427 -0700 +@@ -279,7 +279,7 @@ command_generator (text, state) /* Return the next name which partially matches from the command list. */ @@ -24,43 +10,50 @@ index f1d81af..026a4f4 100644 { list_index++; -diff --git a/src/readline.c b/src/readline.c -index 842ab44..b692e3f 100644 ---- a/src/readline.c -+++ b/src/readline.c -@@ -1270,8 +1270,10 @@ history_truncate_file (const char *filename, int nlines) +diff -durp libedit-20100424-3.0.orig/examples/wtc1.c libedit-20100424-3.0/examples/wtc1.c +--- libedit-20100424-3.0.orig/examples/wtc1.c 2010-04-22 13:13:17.000000000 -0600 ++++ libedit-20100424-3.0/examples/wtc1.c 2011-02-07 13:19:20.839378510 -0700 +@@ -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) +diff -durp libedit-20100424-3.0.orig/src/readline.c libedit-20100424-3.0/src/readline.c +--- libedit-20100424-3.0.orig/src/readline.c 2010-04-24 12:32:18.000000000 -0600 ++++ libedit-20100424-3.0/src/readline.c 2011-02-07 13:14:13.210553427 -0700 +@@ -1273,8 +1273,8 @@ history_truncate_file (const char *filen } } fflush(fp); - if((off = ftello(fp)) > 0) - (void)ftruncate(fileno(fp), off); -+ if((off = ftello(fp)) > 0) { -+ int sink = ftruncate(fileno(fp), off); -+ (void) sink; -+ } ++ if((off = ftello(fp)) > 0 && ftruncate(fileno(fp), off) < 0) ++ ret = errno; out3: fclose(tp); out2: -diff --git a/src/vi.c b/src/vi.c -index 438aad4..a8e5e85 100644 ---- a/src/vi.c -+++ b/src/vi.c -@@ -1004,6 +1004,7 @@ vi_histedit(EditLine *el, int c) - int status; - char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; +diff -durp libedit-20100424-3.0.orig/src/vi.c libedit-20100424-3.0/src/vi.c +--- libedit-20100424-3.0.orig/src/vi.c 2010-04-22 14:09:52.000000000 -0600 ++++ libedit-20100424-3.0/src/vi.c 2011-02-07 13:14:13.211553427 -0700 +@@ -1008,6 +1008,7 @@ vi_histedit(EditLine *el, Int c) char *cp; + size_t len; + Char *line; + el_action_t rv = CC_ERROR; if (el->el_state.doingarg) { if (vi_to_history_line(el, 0) == CC_ERROR) -@@ -1014,14 +1015,15 @@ vi_histedit(EditLine *el, int c) - if (fd < 0) - return CC_ERROR; - cp = el->el_line.buffer; -- write(fd, cp, (size_t)(el->el_line.lastchar - cp)); +@@ -1032,16 +1033,14 @@ vi_histedit(EditLine *el, Int c) + ct_wcstombs(cp, line, TMP_BUFSIZ - 1); + cp[TMP_BUFSIZ - 1] = '\0'; + len = strlen(cp); +- write(fd, cp, len); - write(fd, "\n", 1); -+ if (write(fd, cp, (size_t)(el->el_line.lastchar - cp)) < 0 -+ || write(fd, "\n", 1) < 0) ++ if (write(fd, cp, len) < 0 || write(fd, "\n", 1) < 0) + /* FIXME: handle EAGAIN somehow? */ + goto fail; + @@ -69,12 +62,19 @@ index 438aad4..a8e5e85 100644 case -1: - close(fd); - unlink(tempfile); +- el_free(cp); +- el_free(line); - return CC_ERROR; + goto fail; case 0: close(fd); execlp("vi", "vi", tempfile, (char *)NULL); -@@ -1039,10 +1041,12 @@ vi_histedit(EditLine *el, int c) +@@ -1063,15 +1062,17 @@ vi_histedit(EditLine *el, Int c) + 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); break; } @@ -85,6 +85,8 @@ index 438aad4..a8e5e85 100644 unlink(tempfile); - /* return CC_REFRESH; */ - return ed_newline(el, 0); ++ el_free(cp); ++ el_free(line); + return rv; } diff --git a/libedit.spec b/libedit.spec index 0d2f7dd..a9ce581 100644 --- a/libedit.spec +++ b/libedit.spec @@ -1,4 +1,4 @@ -%define snap 20090923 +%define snap 20100424 Summary: The NetBSD Editline library Name: libedit @@ -15,8 +15,6 @@ Patch0: libedit-3.0-warnings.patch # bz #575383 Patch1: libedit-3.0-sigwinch.patch -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) - BuildRequires: gawk BuildRequires: ncurses-devel @@ -46,7 +44,7 @@ iconv --from-code ISO8859-1 --to-code UTF-8 ./ChangeLog \ --output ChangeLog.utf-8 && mv ChangeLog.utf-8 ./ChangeLog %build -%configure --disable-static +%configure --disable-static --enable-widec # Trying to omit unused direct shared library dependencies leads to # undefined non-weak symbols. @@ -73,7 +71,7 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(-,root,root,-) -%doc examples/fileman.c examples/test.c +%doc examples/fileman.c examples/tc1.c examples/wtc1.c %doc %{_mandir}/man3/* %doc %{_mandir}/man5/editrc.5* %{_includedir}/histedit.h @@ -84,6 +82,10 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/editline/readline.h %changelog +* Mon Feb 7 2011 Jerry James - 3.0-2.20100424cvs +- Update to 3.0 (20100424 snap) +- Enable wide-character (Unicode) support + * Tue Mar 30 2010 Kamil Dudka 3.0-2.20090923cvs - eliminated compile-time warnings - fix to not break the read loop on SIGWINCH, patch contributed diff --git a/sources b/sources index 25b226f..c477ff7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1e6dad38e8499d71b9c78045e5536734 libedit-20090923-3.0.tar.gz +eb4482139525beff12c8ef59f1a84aae libedit-20100424-3.0.tar.gz