Deleted Added
full compact
search.c (1574) search.c (3285)
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

38static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
39#endif /* not lint && not SCCSID */
40
41/*
42 * search.c: History and character search functions
43 */
44#include "sys.h"
45#include <stdlib.h>
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

38static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
39#endif /* not lint && not SCCSID */
40
41/*
42 * search.c: History and character search functions
43 */
44#include "sys.h"
45#include <stdlib.h>
46#ifdef REGEXEC
47#include <sys/types.h>
48#include <regex.h>
49#else
46#ifdef REGEXP
47#include <regexp.h>
48#endif
50#ifdef REGEXP
51#include <regexp.h>
52#endif
53#endif
49#include "el.h"
50
51/*
52 * Adjust cursor in vi mode to include the character under it
53 */
54#define EL_CURSOR(el) \
55 ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \
56 ((el)->el_map.current == (el)->el_map.alt)))

--- 40 unchanged lines hidden (view full) ---

97/* el_match():
98 * Return if string matches pattern
99 */
100protected int
101el_match(str, pat)
102 const char *str;
103 const char *pat;
104{
54#include "el.h"
55
56/*
57 * Adjust cursor in vi mode to include the character under it
58 */
59#define EL_CURSOR(el) \
60 ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \
61 ((el)->el_map.current == (el)->el_map.alt)))

--- 40 unchanged lines hidden (view full) ---

102/* el_match():
103 * Return if string matches pattern
104 */
105protected int
106el_match(str, pat)
107 const char *str;
108 const char *pat;
109{
110#ifdef REGEXEC
111 regex_t re;
112 regmatch_t mb;
113#else
105#ifndef REGEXP
106 extern char *re_comp __P((const char *));
107 extern int re_exec __P((const char *));
108#else
109 regexp *re;
110 int rv;
111#endif
114#ifndef REGEXP
115 extern char *re_comp __P((const char *));
116 extern int re_exec __P((const char *));
117#else
118 regexp *re;
119 int rv;
120#endif
121#endif
112
113 if (strstr(str, pat) != NULL)
114 return 1;
122
123 if (strstr(str, pat) != NULL)
124 return 1;
125#ifdef REGEXEC
126 if (regcomp(&re, pat, REG_EXTENDED) != 0)
127 return 0;
128 return (regexec(&re, str, 1, &mb, 0) == 0);
129#else
115#ifndef REGEXP
116 if (re_comp(pat) != NULL)
117 return 0;
118 else
119 return re_exec(str) == 1;
120#else
121 if ((re = regcomp(pat)) != NULL) {
122 rv = regexec(re, str);
123 free((ptr_t) re);
124 }
125 else
126 rv = 0;
127 return rv;
128#endif
130#ifndef REGEXP
131 if (re_comp(pat) != NULL)
132 return 0;
133 else
134 return re_exec(str) == 1;
135#else
136 if ((re = regcomp(pat)) != NULL) {
137 rv = regexec(re, str);
138 free((ptr_t) re);
139 }
140 else
141 rv = 0;
142 return rv;
143#endif
129
144#endif
130}
131
132
133/* c_hmatch():
134 * return True if the pattern matches the prefix
135 */
136protected int
137c_hmatch(el, str)

--- 482 unchanged lines hidden ---
145}
146
147
148/* c_hmatch():
149 * return True if the pattern matches the prefix
150 */
151protected int
152c_hmatch(el, str)

--- 482 unchanged lines hidden ---