Commit Graph

80 Commits

Author SHA1 Message Date
Eric Andersen
8876fb2f59 last_patch89 from vodz:
Manuel,

    I rewrite bb_getopt_ulflags() function for more universal usage.
    My version support now:
    - options with arguments (optional arg as GNU extension also)
    - complementaly and/or incomplementaly and/or incongruously and/or list
    options
    - long_opt (all applets may have long option, add supporting is trivial)
    This realisation full compatibile from your version.
    Code size grow 480 bytes, but only coreutils/* over compensate this size
    after using new function. Last patch reduced over 800 bytes and not full
    applied to all. "mkdir" and "mv" applets have long_opt now for demonstrate
    trivial addition support long_opt with usage new bb_getopt_ulflags().
    Complementaly and/or incomplementaly and/or incongruously and/or list options
    logic is not trivial, but new "cut" and "grep" applets using this logic
    for examples with full demostrating. New "grep" applet reduced over 300
    bytes.

    Mark,
    Also. I removed bug from "grep" applet.
    $ echo a b | busybox grep -e a b
    a b
    a b
    But right is printing one only.

    --w
    vodz
2003-06-20 09:01:58 +00:00
Glenn L McGrath
c5408fe7f7 Fix segfault when cleaning up 2003-04-27 02:22:01 +00:00
Glenn L McGrath
26df70a823 grep -f support, adds only 60 Bytes, but regex's now compiled as
required, rather than being pre-compiled.
2003-04-27 01:50:57 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Aaron Lehmann
a170e1c858 Change if(x)free(x); to free(x); 2002-11-28 11:27:31 +00:00
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