diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-07-07 16:15:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-07-07 16:15:48 +0000 |
commit | ced793f8cd6cb7782cf56d0aedfd122cc88a1828 (patch) | |
tree | 4cf945fc8c3fa3ab78156fac06d881ea4afa2272 /lib | |
parent | 7f1710fee77d8eecf8c2f6a38b01eff798eeedc8 (diff) |
Enable wide character functions in libedit (not the other libe*t).
ok stsp deraadt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libedit/Makefile | 33 | ||||
-rw-r--r-- | lib/libedit/chartype.h | 4 | ||||
-rw-r--r-- | lib/libedit/editline.3 | 56 |
3 files changed, 79 insertions, 14 deletions
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index d0362180d3b..3063198e46e 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2010/06/30 00:05:35 nicm Exp $ +# $OpenBSD: Makefile,v 1.11 2011/07/07 16:15:47 nicm Exp $ # $NetBSD: Makefile,v 1.41 2010/02/03 15:34:43 roy Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 @@ -6,21 +6,34 @@ LIB= edit WANTLINT= USE_SHLIBDIR= yes +WIDECHAR= yes + OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ hist.c key.c map.c chartype.c \ parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c MAN= editline.3 editrc.5 -MLINKS= editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \ - editline.3 el_gets.3 editline.3 el_getc.3 editline.3 el_push.3 \ - editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_get.3 \ - editline.3 el_source.3 editline.3 el_resize.3 editline.3 el_line.3 \ - editline.3 el_insertstr.3 editline.3 el_deletestr.3 \ - editline.3 history_init.3 editline.3 history_end.3 \ - editline.3 history.3 \ - editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \ - editline.3 tok_line.3 editline.3 tok_str.3 +MLINKS= editline.3 el_deletestr.3 editline.3 el_end.3 \ + editline.3 el_get.3 editline.3 el_getc.3 \ + editline.3 el_gets.3 editline.3 el_init.3 \ + editline.3 el_insertstr.3 editline.3 el_line.3 \ + editline.3 el_parse.3 editline.3 el_push.3 \ + editline.3 el_reset.3 editline.3 el_resize.3 \ + editline.3 el_set.3 editline.3 el_source.3 \ + editline.3 el_wdeletestr.3 editline.3 el_wget.3 \ + editline.3 el_wgetc.3 editline.3 el_wgets.3 \ + editline.3 el_winsertstr.3 editline.3 el_wline.3 \ + editline.3 el_wparse.3 editline.3 el_wpush.3 \ + editline.3 el_wset.3 editline.3 history.3 \ + editline.3 history_end.3 editline.3 history_init.3 \ + editline.3 history_w.3 editline.3 history_wend.3 \ + editline.3 history_winit.3 editline.3 tok_end.3 \ + editline.3 tok_init.3 editline.3 tok_line.3 \ + editline.3 tok_reset.3 editline.3 tok_str.3 \ + editline.3 tok_wend.3 editline.3 tok_winit.3 \ + editline.3 tok_wline.3 editline.3 tok_wreset.3 \ + editline.3 tok_wstr.3 # For speed and debugging #SRCS= ${OSRCS} tokenizer.c history.c readline.c diff --git a/lib/libedit/chartype.h b/lib/libedit/chartype.h index 9deaf33a6d9..83fafa2b15a 100644 --- a/lib/libedit/chartype.h +++ b/lib/libedit/chartype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: chartype.h,v 1.3 2011/07/07 05:40:42 okan Exp $ */ +/* $OpenBSD: chartype.h,v 1.4 2011/07/07 16:15:47 nicm Exp $ */ /* $NetBSD: chartype.h,v 1.5 2010/04/15 00:55:57 christos Exp $ */ /*- @@ -45,7 +45,7 @@ * supports non-BMP code points without requiring UTF-16, but nothing * seems to actually advertise this properly, despite Unicode 3.1 having * been around since 2001... */ -#ifndef __NetBSD__ +#if !defined(__NetBSD__) && !defined(__OpenBSD__) #ifndef __STDC_ISO_10646__ /* In many places it is assumed that the first 127 code points are ASCII * compatible, so ensure wchar_t indeed does ISO 10646 and not some other diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3 index ad0c064658e..82951cdc56b 100644 --- a/lib/libedit/editline.3 +++ b/lib/libedit/editline.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: editline.3,v 1.31 2011/03/02 07:46:15 jmc Exp $ +.\" $OpenBSD: editline.3,v 1.32 2011/07/07 16:15:47 nicm Exp $ .\" $NetBSD: editline.3,v 1.73 2010/01/03 19:05:26 wiz Exp $ .\" .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: March 2 2011 $ +.Dd $Mdocdate: July 7 2011 $ .Dt EDITLINE 3 .Os .Sh NAME @@ -36,24 +36,41 @@ .Nm el_end , .Nm el_reset , .Nm el_gets , +.Nm el_wgets , .Nm el_getc , +.Nm el_wgetc , .Nm el_push , +.Nm el_wpush , .Nm el_parse , +.Nm el_wparse , .Nm el_set , +.Nm el_wset , .Nm el_get , +.Nm el_wget , .Nm el_source , .Nm el_resize , .Nm el_line , +.Nm el_wline , .Nm el_insertstr , +.Nm el_winsertstr , .Nm el_deletestr , +.Nm el_wdeletestr , .Nm history_init , +.Nm history_winit , .Nm history_end , +.Nm history_wend , .Nm history , +.Nm history_w , .Nm tok_init , +.Nm tok_winit , .Nm tok_end , +.Nm tok_wend , .Nm tok_reset , +.Nm tok_wreset , .Nm tok_line , +.Nm tok_wline , .Nm tok_str +.Nm tok_wstr .Nd line editor, history and tokenization functions .Sh SYNOPSIS .Fd #include <histedit.h> @@ -65,17 +82,29 @@ .Fn el_reset "EditLine *e" .Ft const char * .Fn el_gets "EditLine *e" "int *count" +.Ft const wchar_t * +.Fn el_wgets "EditLine *e" "int *count" .Ft int .Fn el_getc "EditLine *e" "char *ch" +.Ft int +.Fn el_wgetc "EditLine *e" "wchar_t *ch" .Ft void .Fn el_push "EditLine *e" "const char *str" +.Ft void +.Fn el_wpush "EditLine *e" "const wchar_t *str" .Ft int .Fn el_parse "EditLine *e" "int argc" "const char *argv[]" .Ft int +.Fn el_wparse "EditLine *e" "int argc" "const wchar_t *argv[]" +.Ft int .Fn el_set "EditLine *e" "int op" "..." .Ft int +.Fn el_wset "EditLine *e" "int op" "..." +.Ft int .Fn el_get "EditLine *e" "int op" "..." .Ft int +.Fn el_wget "EditLine *e" "int op" "..." +.Ft int .Fn el_source "EditLine *e" "const char *file" .Ft void .Fn el_resize "EditLine *e" @@ -83,24 +112,44 @@ .Fn el_line "EditLine *e" .Ft int .Fn el_insertstr "EditLine *e" "const char *str" +.Ft int +.Fn el_winsertstr "EditLine *e" "const wchar_t *str" .Ft void .Fn el_deletestr "EditLine *e" "int count" +.Ft void +.Fn el_wdeletestr "EditLine *e" "int count" .Ft History * .Fn history_init +.Ft HistoryW * +.Fn history_winit .Ft void .Fn history_end "History *h" +.Ft void +.Fn history_wend "HistoryW *h" .Ft int .Fn history "History *h" "HistEvent *ev" "int op" "..." +.Ft int +.Fn history_w "HistoryW *h" "HistEventW *ev" "int op" "..." .Ft Tokenizer * .Fn tok_init "const char *IFS" +.Ft TokenizerW * +.Fn tok_winit "const wchar_t *IFS" .Ft void .Fn tok_end "Tokenizer *t" .Ft void +.Fn tok_wend "TokenizerW *t" +.Ft void .Fn tok_reset "Tokenizer *t" +.Ft void +.Fn tok_wreset "TokenizerW *t" .Ft int .Fn tok_line "Tokenizer *t" "const LineInfo *li" "int *argc" "const char **argv[]" "int *cursorc" "int *cursoro" .Ft int +.Fn tok_wline "TokenizerW *t" "const LineInfoW *li" "int *argc" "const wchar_t **argv[]" "int *cursorc" "int *cursoro" +.Ft int .Fn tok_str "Tokenizer *t" "const char *str" "int *argc" "const char **argv[]" +.Ft int +.Fn tok_wstr "TokenizerW *t" "const wchar_t *str" "int *argc" "const wchar_t **argv[]" .Sh DESCRIPTION The .Nm @@ -123,6 +172,9 @@ which is created by and freed by .Fn el_end . .Pp +The wide-character functions behave the same way as their narrow +counterparts. +.Pp The following functions are available: .Bl -tag -width 4n .It Fn el_init |