Commit Graph

669 Commits

Author SHA1 Message Date
Pavel Roskin
cc8a66b113 Moved functions used by "lsmod" from cat.c to utility.c
Adjusted to make lsmod and sh compilable as standalone apps.
Comment fixes
2000-07-17 20:18:42 +00:00
Mark Whitley
97562bd9d7 - Added support for backreferences in substitution expressions up to nine
(\1, \2...\9). This touched a lot of places in this file and I added a new
   function 'print_subst_w_backrefs' in order to keep 'do_subst_command' a
   little more tidy.

	* I tested this good 'n hard, but will always appreciate more testing from
	  other, willing folks.

 - Noticed that the index_of_next_unescaped_slash was subtly wrong so I
   changed both the functionality and behavior (it used to skip over the first
   char in the string you passed it, assuming it was a leading '/'--this
   assumption is no longer made) this necessitated changing the lines that
   call this function just slightly.
2000-07-17 20:06:42 +00:00
Pavel Roskin
21ddb38fcf Now it's possible to compile Busybox with only one app defined
(unless it's lsmod, to be fixed by the next commit)
2000-07-17 19:31:54 +00:00
Eric Andersen
a1d187a8a8 Backtick support to infinite (memory limited) levels of nesting is
now implemented...  So now busybox shell can do cool stuff like:

    /home/andersen/CVS/busybox # echo foo `wc README` bar
    foo 71 422 2951 README bar

I love writing cool new features....  Muhahahaha...  (I think this is
leaking a little bit of memory every time it expands a backtick process,
so I still needs to do a bit of cleanup...)
 -Erik
2000-07-17 19:14:41 +00:00
Pavel Roskin
bc0aed79a8 It is now possible to select in busybox.def.h whether minixfs version 2
is to be supported.
2000-07-17 17:52:00 +00:00
Pavel Roskin
47d4926244 The result of getopt() is "int" and should be treated as such 2000-07-17 16:17:19 +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
Mark Whitley
464c5de00d Fixed a couple of buglets:
- add_cmd_str: segv's were being generated if there was a '# comment' line
   (and probably other kinds of lines, too) that was not followed by a
   semi-colon or whitespace
 - parse_edit_cmd: was returning a wrong number (too low) for the index; it
   was not accounting for backslashes eaten, for the fact that we start at the
   3rd index in the string, or for the fact that we add an extra newline.
 - parse_cmd_str: was returning a wrong number (again, too low) for the index
   in the case of single-letter commands (p,d). There was some
   over-compensation for this in the 'return' stmt at the end which also
   needed some help.
 - load_cmd_file: was not eating trailing newlines off the line read from the
   command file. This had the deleterious effect of printing an extra newlines
   after text displayed from edit (i,a,c) commands.
2000-07-14 23:24:00 +00:00
Mark Whitley
70705d7c96 - Added support for semicolon delimited command lines. (woo-hoo!)
- Obsoleted the trim_str function (#if 0'ed out -- maybedelete later) in
   favor of strrspn.
 - Obsoleted the strrspn function (#if 0'ed out as well) as soon as I
   discovered that it wasn't needed either.
 - Fixed a subtle bug in parse_subst_cmd where it would choke with an error if
   there was any trailing space after the s/match/replace/ expression.
2000-07-14 19:06:30 +00:00
Eric Andersen
add09fd558 Getopt'ed by Marc Nijdam <marc_nijdam@hp.com>
-Erik
2000-07-14 18:39:08 +00:00
Eric Andersen
17ad45aace Getopt'rd by Marc Nijdam <marc_nijdam@hp.com>
-Erik
2000-07-14 18:38:26 +00:00
Pavel Roskin
df4532bfa3 More fixes for "signed vs. unsigned" warnings. 2000-07-14 17:24:58 +00:00
Pavel Roskin
ff5a9033f9 Reduced the number of "signed vs. unsigned" warnings.
Sometimes such warnings matter (esp. on PPC with char default to unsigned)
2000-07-14 16:23:32 +00:00
Pavel Roskin
f626dcbc84 More fixes for "missing initializers" 2000-07-14 15:55:41 +00:00
Pavel Roskin
9027bcf2f4 Fixed a warning about missing initializer 2000-07-14 15:44:25 +00:00
Pavel Roskin
93c0d9f090 The result of getopt() should not be converted to "char" - it breaks on PPC 2000-07-14 15:18:57 +00:00
Eric Andersen
fad04fdd12 More cleanups.
-Erik
2000-07-14 06:49:52 +00:00
Matt Kraai
b870af09ae Fix argument parsing. 2000-07-14 06:47:33 +00:00
Eric Andersen
d6912c97de Be more pedantic aboutthe terminating null applet.
-Erik
2000-07-14 06:29:10 +00:00
Eric Andersen
58361a44b5 uid and gid were unsigned, but were compared vs signed values (-1)
-Erik
2000-07-14 06:27:54 +00:00
Eric Andersen
e7413a9cde A couple of minor warning cleanups.
-Erik
2000-07-14 06:19:41 +00:00
Matt Kraai
d537a95fdb Use errorMsg rather than fprintf. 2000-07-14 01:51:25 +00:00
Eric Andersen
4ac6cb534d Fix some stupid memory bugs.
-Erik
2000-07-14 01:13:37 +00:00
Eric Andersen
ec10b9d534 Add in redimentary backtick suport (doesn't work properly yet, but is
close).
 -Erik
2000-07-14 01:13:11 +00:00
Mark Whitley
34623db618 It dawned on me that I would need to grow a char buffer one extra char bigger
to accomodate a trailing '\n'ewline that I append to it later one. This is
only necessary for the case of one inserted, appended, or changed line, but
it's still necessary.
2000-07-14 00:49:59 +00:00
Mark Whitley
02008346c0 Added error checking for edit commands; only a beginning address can be
specified.
2000-07-14 00:13:52 +00:00
Mark Whitley
94074a980c Added support for (a)ppend, (i)nsert, and (c)hange commands to sed. 2000-07-14 00:00:15 +00:00
Mark Whitley
496e33feeb Fixed bug where sed '/foo/p' was printing "invalid command". 2000-07-13 22:52:02 +00:00
Mark Whitley
4f7fe77d07 (Something I should have done in the previous checkin...) Also broke out
substitution command execution from do_sed_command() and put it in it's own
do_subst_command() function.
2000-07-13 20:01:58 +00:00
Mark Whitley
06f3529ada Minor code reorg: Changed the interface to index_of_next_unescaped_slash to an
interface that seems a little more sensible to me. Also broke out s///
expression parsing into it's own subroutine.
2000-07-13 19:58:04 +00:00
Eric Andersen
156959ea93 Fix uninitialized variable.
-Erik
2000-07-13 19:49:12 +00:00
Eric Andersen
f4c022649b Patch from Marc Nijdam <marc_nijdam@hp.com>
> First (of many more) patch of cp_mv to getopt use. I'm using the most
> simplistic approach, just get getopt used,  then worry about a cleaner
> option parsing style using getopt later.
>
> Marc
2000-07-13 18:42:58 +00:00
Mark Whitley
55380700d8 Added a smallish TODO comment. 2000-07-13 17:20:23 +00:00
Eric Andersen
00143ba921 From Matt Kraai <kraai@alumni.carnegiemellon.edu>
> Here is a patch so that tr can handle NULL characters as well.  Give it
> a shot and let me know what you think.  It is against the latest CVS
> version.
>
> In my tests, the following now works as expected.
>
> tr '\0' '\n'
>
> Later,
> Matt
2000-07-13 16:40:41 +00:00
Matt Kraai
ac48461da9 Correct argument parsing and other minor cleanups. 2000-07-13 06:33:12 +00:00
Mark Whitley
37653aaf9c Added some smallish comments to help folks understand why we have two tables
of builtins and the reasoning behind it.
2000-07-12 23:36:17 +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
Eric Andersen
6f96e674b9 Patch from Jon McClintock <jonm@bluemug.com>
>The attached patch adds the ability to parse the actual mode specifier in
>fbset. So now
>
>    fbset -n 640x480-72
>
>Will actually work. I don't know if I've reinvented the wheel though...

 -Erik
2000-07-12 23:01:04 +00:00
Matt Kraai
be84cd4ef6 Always report the applet name when doing error reporting. 2000-07-12 17:02:35 +00:00
Matt Kraai
e58771e73c Use global applet_name instead of local versions. 2000-07-12 15:38:49 +00:00
Matt Kraai
e714bce003 Use global applet_name instead of local versions. 2000-07-12 00:53:06 +00:00
Matt Kraai
3ecbe9f4dc The applet name isn't constant. 2000-07-12 00:43:28 +00:00
Eric Andersen
97426e082a Changed verbiage.
-Erik
2000-07-11 23:06:48 +00:00
Eric Andersen
8fbaeece53 Replaced projects with products/projects.
-Erik
2000-07-11 23:05:38 +00:00
Eric Andersen
68fda241d2 Added the Kerbango Internet Radio to projects/products using BusyBox.
-Erik
2000-07-11 23:03:40 +00:00
Mark Whitley
858c1adf2b Applied patch from Matt Kraai to call destroy_cmd_strs in atexit(), rather
than peppering it throughout the code.
2000-07-11 21:38:47 +00:00
Matt Kraai
7719008a85 Added applet_name to contain the applet name. 2000-07-11 20:03:24 +00:00
Eric Andersen
aec27bca98 Final updates for release.
-Erik
2000-07-11 18:18:40 +00:00
Eric Andersen
960be79964 Final update for the release. 2000-07-11 18:06:01 +00:00