Commit Graph

75 Commits

Author SHA1 Message Date
Matt Kraai
eed9451cf6 * findutils/grep.c (grep_main): Remove unnecessary use of junk. 2002-02-22 22:08:16 +00:00
Matt Kraai
585f657e2d Fix undeclared variable error. 2001-11-20 16:00:44 +00:00
Eric Andersen
81ee96fe62 Usr get_last_path_component() name basename() 2001-11-20 00:23:48 +00:00
Eric Andersen
6f8b7ea452 oops 2001-11-19 11:45:39 +00:00
Eric Andersen
55805bcba4 More scrubbing 2001-11-19 10:59:37 +00:00
Eric Andersen
43626d7671 Fixup CLEANUP behavior 2001-11-19 10:36:20 +00:00
Matt Kraai
a21c24bf03 Convert strdup call to xstrdup, and calloc calls to xcalloc (patch from
Steve Merrifield).
2001-11-12 16:58:07 +00:00
Eric Andersen
dba4e6f046 Add in grep -E support 2001-11-10 12:54:00 +00:00
Matt Kraai
bb0088e980 Make egrep only set REG_EXTENDED flag. 2001-10-31 16:16:31 +00:00
Eric Andersen
ccd96f1972 Patch from Charles Steinkuehler <charles@steinkuehler.net>
to properly handle extended regexps for egrep
2001-10-31 10:02:46 +00:00
Matt Kraai
999623e973 Use extended regular expressions when invoked as egrep (noted and initial
patch by Charles Steinkuehler).
2001-10-29 15:49:03 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
74400ccfd0 Scrub up some function prototypes.
-Erik
2001-10-18 04:11:39 +00:00
Eric Andersen
0034443140 Fix behavior of grep -lc to match GNU grep. SuS2 is ambiguous
on the correct behavior, so acting like GNU grep seems best
 -Erik
2001-07-31 23:18:49 +00:00
Eric Andersen
86f0167e39 grep failed to compile when BB_FEATURE_CLEAN_UP was defined -- types were wrong. 2001-05-29 22:36:39 +00:00
Mark Whitley
fa43e54b6f Added support for grep -e and grep -f, closes bug #1164. Also added some
testcases for these new features.
2001-05-24 18:36:18 +00:00
Matt Kraai
edc806507c Fixed extra -- lines (noted by Christophe Boyanique). 2001-05-22 14:29:27 +00:00
Mark Whitley
1d9d41150b Fixed mishandling of -c & -l options and accounted for case when we're
grepping only one file.
2001-05-21 21:13:00 +00:00
Matt Kraai
59df6f7398 Change 'printf("%s\n", ...)' into 'puts(...)'. Noted and patched in hostname.c
by Larry Doolittle.
2001-05-16 14:21:09 +00:00
Mark Whitley
35e59bed97 Fixed a subtle bug in the handling of -l and -c flags. 2001-05-14 19:40:32 +00:00
Mark Whitley
59a86cad67 The tiniest of bracket-placement fixes. 2001-04-17 17:30:44 +00:00
Eric Andersen
303dd28bb0 Make 'grep -l' work 2001-04-09 23:26:31 +00:00
Mark Whitley
4391a16c92 Fixed option parsing. Grep would continue grepping, even when given a bad /
invalid option. Closes bug #1146.
2001-04-09 23:00:07 +00:00
Eric Andersen
67991cf824 This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
2001-02-14 21:23:06 +00:00
Mark Whitley
2fd52989f7 Implemented -A, -B, and -C flags with BB_FEATURE_GREP_CONTEXT option set. 2001-02-09 00:41:10 +00:00
Mark Whitley
b5c29850e3 Tightened things up a bit, saved 20 bytes, and made the code a bit clearer in
the process.
2001-02-01 21:02:41 +00:00
Matt Kraai
05e782ddd3 Fix wget error message and add (and use) chomp library function. 2001-02-01 16:49:30 +00:00
Eric Andersen
8ec10a9483 Fix up copyright msgs. Bump version to 0.49 in preparation for
a release.  Update the website with release details.
 -Erik
2001-01-27 09:33:39 +00:00
Eric Andersen
ed3ef50c23 Fix header file usage -- there were many unnecessary header files included in
busybox.h which slowed compiles.  I left only what was needed and then fixed up
all the apps to include their own header files.  I also fixed naming for pwd.h
and grp.h functions.  Tested to compile and run with libc5, glibc, and uClibc.
 -Erik
2001-01-27 08:24:39 +00:00
Mark Whitley
6c6ea6cba2 Changed email address to codepoet.org, updated list of applets / docs I
maintain in AUTHORS.
2001-01-04 22:21:13 +00:00
Matt Kraai
0810f723b1 Fixed -qv interaction (thanks to a report and patch from David Douthitt). 2001-01-04 15:11:52 +00:00
Matt Kraai
1fa1adea2a Change calls to error_msg.* and strerror to use perror_msg.*. 2000-12-18 03:57:16 +00:00
Mark Whitley
f57c944e09 Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
2000-12-07 19:56:48 +00:00
Matt Kraai
567cdd1d51 Fix handling of ^$ by removing the newline from input lines and by not
compiling with REG_NEWLINE.
2000-10-13 18:55:06 +00:00
Eric Andersen
3570a34de4 Renamed "internal.h" to the more sensible "busybox.h".
-Erik
2000-09-25 21:45:58 +00:00
Matt Kraai
deb95f69b6 Exit with the appropriate value when grepping multiple files. 2000-08-06 15:25:53 +00:00
Matt Kraai
27a804246a Centralize handling of --help. 2000-07-19 19:24:01 +00:00
Mark Whitley
2ef880b236 Consolodated some common code into print_matched_line to make 'grep_file' a
little more terse & clean. Also made a few minor formatting changes.
2000-07-18 21:02:06 +00:00
Mark Whitley
8f122431f5 Added support for the -c (count matches) option. Made it so it works just like
GNU grep.
2000-07-18 18:37:01 +00:00
Matt Kraai
bf181b9338 Extract usage information into a separate file. 2000-07-16 20:57:15 +00:00
Matt Kraai
d537a95fdb Use errorMsg rather than fprintf. 2000-07-14 01:51:25 +00:00
Mark Whitley
c41e8c840f Changed bb_regcomp to xregcomp and #if 0'ed out destroy_cmd_strs in sed.c
(maybe I'll remove it later).
2000-07-12 23:35:21 +00:00
Mark Whitley
df5f6ba115 Applied patch from Matt Kraai which does the following:
- adds case-insensitive matching in sed s/// epxressions
 - consolodates common regcomp code in grep & sed into bb_regcomp and put in
   utility.c
 - cleans up a bunch of cruft
2000-07-11 16:53:56 +00:00
Mark Whitley
44735f8744 Applied patch from Matt Kraai as per his email:
However, the case of

	grep foo$ file

didn't work, due to a problem with the flags used in regular expression
compilation.  The attached patch fixes this problem.

---patch-------
Index: grep.c
===================================================================
RCS file: /var/cvs/busybox/grep.c,v
retrieving revision 1.30
diff -u -r1.30 grep.c
--- grep.c      2000/07/04 22:17:01     1.30
+++ grep.c      2000/07/10 08:57:04
@@ -141,8 +141,10 @@
        if (argv[optind] == NULL)
                usage(grep_usage);

-       /* compile the regular expression */
-       reflags = REG_NOSUB; /* we're not going to mess with sub-expressions
        */
+       /* compile the regular expression
+        * we're not going to mess with sub-expressions, and we need to
+        * treat newlines right. */
+       reflags = REG_NOSUB | REG_NEWLINE;
        if (ignore_case)
                reflags |= REG_ICASE;
        if ((ret = regcomp(&regex, argv[optind], reflags)) != 0) {
---patch-------

Thanks, Matt, it works great.
2000-07-10 15:50:26 +00:00
Eric Andersen
e9b527ae48 include getopt.h
-Erik
2000-07-09 05:56:14 +00:00
Eric Andersen
2086e3d679 Some cosmetic updates. Changed "OPTIONS" to "Options".
-Erik
2000-07-04 22:17:01 +00:00
Mark Whitley
2e1148b239 Fixed comment. 2000-06-28 22:59:30 +00:00
Mark Whitley
8bd891cbec Added support for reading from stdin with '-' as file name arg. 2000-06-28 22:55:59 +00:00
Mark Whitley
1ca41775bb Yanked out the cstring_alloc() and cstring_lineFromFile() functions from
utility.c and replaced them with get_line_from_file() from the new grep.c.
Also changed declaration in internal.h and replaced instances of
cstring_lineFromFile() in dc.c and sort.c with get_line_from_file(). Tested
them and they worked fine.
2000-06-28 22:15:26 +00:00
Mark Whitley
d37218941c Brand, spankin', new grep that uses libc regex routines instead of the
hand-rolled ones. Sed still needs to be replaced and then the regexp stuff can
be axed.
2000-06-28 22:00:26 +00:00