From 68177f2606095b3d125426cefcb4dba56a7a700c Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 2 Oct 1994 01:33:28 +0000 Subject: Rewritten using POSIX regex Add 57600 and 115200 speeds Correct termcap path --- lib/libedit/search.c | 17 ++++++++++++++++- lib/libedit/sys.h | 5 +++-- lib/libedit/term.c | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'lib/libedit') diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 4ff9c61..c57b96b 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -43,9 +43,14 @@ static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; */ #include "sys.h" #include +#ifdef REGEXEC +#include +#include +#else #ifdef REGEXP #include #endif +#endif #include "el.h" /* @@ -102,6 +107,10 @@ el_match(str, pat) const char *str; const char *pat; { +#ifdef REGEXEC + regex_t re; + regmatch_t mb; +#else #ifndef REGEXP extern char *re_comp __P((const char *)); extern int re_exec __P((const char *)); @@ -109,9 +118,15 @@ el_match(str, pat) regexp *re; int rv; #endif +#endif if (strstr(str, pat) != NULL) return 1; +#ifdef REGEXEC + if (regcomp(&re, pat, REG_EXTENDED) != 0) + return 0; + return (regexec(&re, str, 1, &mb, 0) == 0); +#else #ifndef REGEXP if (re_comp(pat) != NULL) return 0; @@ -126,7 +141,7 @@ el_match(str, pat) rv = 0; return rv; #endif - +#endif } diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h index cc260f5..eccf30d 100644 --- a/lib/libedit/sys.h +++ b/lib/libedit/sys.h @@ -76,10 +76,11 @@ typedef char* ioctl_t; #endif #include -#define REGEXP +#define REGEXEC +#undef REGEXP #ifdef SUNOS -# undef REGEXP +# undef REGEXEC # include typedef void (*sig_t)__P((int)); # ifdef __GNUC__ diff --git a/lib/libedit/term.c b/lib/libedit/term.c index 4971ef1..053f052 100644 --- a/lib/libedit/term.c +++ b/lib/libedit/term.c @@ -135,6 +135,12 @@ private struct { #ifdef B38400 { "38400", B38400 }, #endif +#ifdef B57600 + { "57600", B57600 }, +#endif +#ifdef B115200 + { "115200", B115200 }, +#endif { NULL, 0 } }; @@ -834,7 +840,11 @@ term_set(el, term) if (i <= 0) { if (i == -1) +#ifdef __FreeBSD__ + (void) fprintf(el->el_errfile, "Cannot open /usr/share/misc/termcap.\n"); +#else (void) fprintf(el->el_errfile, "Cannot open /etc/termcap.\n"); +#endif else if (i == 0) (void) fprintf(el->el_errfile, "No entry for terminal type \"%s\"\n", term); -- cgit v1.1