Commit Graph

57 Commits

Author SHA1 Message Date
Glenn L McGrath
38c8551cf2 Path count was out by one, fixed it 2000-09-18 09:52:03 +00:00
Glenn L McGrath
63dde9d4ce Simplify and remove dependence on PATH_MAX
buf[PATH_MAX] now defined using strlen to the exact size to be used.
removed output that was displayed if which didnt find the command, this makes itmatch the behaviour of GNU's which.
These modifications result in a slight size decrease.
2000-09-18 09:37:40 +00:00
Matt Kraai
322ae93a5e Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
segfaulting or handling errors the same way themselves.
2000-09-13 02:46:14 +00:00
Eric Andersen
88f50b6bf5 Some #include updates.
-Erik
2000-08-10 17:59:11 +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
3bd8bd89ee Don't use strings directly in calls to usage(). This is in preparation
for their extraction to a separate file.
2000-07-14 23:28:47 +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
928faac503 Removed unnecessary #include "regexp.h" line from find.c as per Matt Kraai's
suggestion on the mailing list.
2000-07-10 19:29:09 +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
Eric Andersen
b610615be9 Updates to a number of apps to remove warnings/compile errors under libc5.
Tested under both libc5 and libc6 and all seems well with these fixes.
 -Erik
2000-06-19 17:25:40 +00:00
Eric Andersen
74c66ad06e Fix some spelling errors in the source as well.
-Erik
2000-06-16 19:57:44 +00:00
John Beppu
d84990eb1f + removed some cruft left over from when lines could be too long. 2000-06-14 00:19:14 +00:00
Eric Andersen
053b1462b7 Fix a bug pointed out by Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
where you used to see:
      ./grep -q -i B some_file
      B: No such file or directory
This is now fixed.
 -Erik
2000-06-13 06:24:53 +00:00
John Beppu
c7ccfc99fc + utility.c
CSTRING_BUFFER_LENGTH = 1024 /* so it recurses less often */
+ grep.c
  uses cstring_lineFromFile(), and doesn't ever say
  Line is too long, anymore
2000-06-12 23:39:04 +00:00
Pavel Roskin
c389d91181 "which" rewritten to use stat(). Fixes to improve its compatability
with traditional implementations
2000-06-05 23:41:27 +00:00
Erik Andersen
330fd2b576 More libc portability updates, add in the website (which has not been
archived previously).  Wrote 'which' during the meeting today.
 -Erik
2000-05-19 05:35:19 +00:00
Erik Andersen
7ab9c7ee52 Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP
which lets you compile out most of the "--help" output, saving
up to 17k.

Renamed mnc to nc.
 -Erik
2000-05-12 19:41:47 +00:00
John Beppu
f93a95de69 + grep -v # yay! 2000-04-24 18:07:30 +00:00
Erik Andersen
9cf3bfa7c1 More doc updates for BusyBox, with fixes to apps for bugs revealed
while trying to write docs . :-)
 -Erik
2000-04-13 18:49:43 +00:00
Erik Andersen
61677feff7 Upates to include copyright 2000 to everything
-Erik
2000-04-13 01:18:56 +00:00
Erik Andersen
3364d78b18 Yet another installment in the ongoing tar saga
-Erik
2000-03-28 00:58:14 +00:00
Erik Andersen
4d0543138e More minor touchups.
-Erik
2000-02-10 07:31:15 +00:00
Erik Andersen
e49d5ecbbe Some formatting updates (ran the code through indent)
-Erik
2000-02-08 19:58:47 +00:00
Erik Andersen
fac10d7c59 A few minor updates. ;-)
Seriously though, read the Changelog for busybox 0.42,
which this is about to become...
 -Erik
2000-02-07 05:29:42 +00:00
Erik Andersen
04e97024e7 Clear up some ambiguity with old style assignments.
-Erik
2000-01-29 07:06:24 +00:00
Erik Andersen
a2f69e5485 Bug fix. grep wasn't printing file names they way it was supposed to.
-Erik
2000-01-19 04:30:37 +00:00
Erik Andersen
2fe08c7afb Fixed cp so it works as God intended it to.
-Erik
1999-12-29 02:10:35 +00:00
Erik Andersen
3fe2ecf0d9 Added grep -q, thanks to a patch from "Konstantin Boldyshev" <konst@voshod.com>
-Erik
1999-12-21 08:52:04 +00:00
Eric Andersen
b186d980d6 Stuf 1999-12-03 09:19:54 +00:00
Eric Andersen
d73dc5b073 Updates to usage, and made tar work.
-Erik
1999-11-10 23:13:02 +00:00
Eric Andersen
50d6360771 Stuff 1999-11-09 01:47:36 +00:00
Eric Andersen
fbb39c83b6 Stuff
-Erik
1999-11-08 17:00:52 +00:00
Eric Andersen
6b6b3f6ef2 Stuf 1999-10-28 16:06:25 +00:00
Eric Andersen
aa0765e11b Added regexp support, fixed Changelog. 1999-10-22 04:30:20 +00:00
Eric Andersen
c49960189a Fixed up copyright notices and such 1999-10-20 22:08:37 +00:00
Eric Andersen
e77ae3a2c0 Added sfdisk. Ststic-ified a bunch of stuff. 1999-10-19 20:03:34 +00:00
Eric Andersen
3e0fbae15e fixes grep, added loadfont from debian bootfloppies.
-Erik
1999-10-19 06:02:44 +00:00
Eric Andersen
b0e9a709ba More stuff.
-Erik
1999-10-18 22:28:26 +00:00