Commit Graph

181 Commits

Author SHA1 Message Date
Mark Whitley
3950596e1e Converted option parsing to using getopt(). Also managed to remove an
extraneous logic loop that existed only for the purpose of the special case of
only one file. I replaced it with a variable to keep track of the number of
files read.
2000-07-20 00:08:10 +00:00
Mark Whitley
99e370f0c6 Whoops. Forgot to #include <getopt.h>. 2000-07-20 00:03:38 +00:00
Mark Whitley
aa4f108338 Converted option parsing to getopt() and made some minor formatting changes. 2000-07-19 19:38:13 +00:00
Matt Kraai
27a804246a Centralize handling of --help. 2000-07-19 19:24:01 +00:00
Matt Kraai
2f46b664b7 Add usage messages for applets without them. 2000-07-19 18:01:00 +00:00
Eric Andersen
a16c66335e Use FatalError()
-Erik
2000-07-19 17:36:27 +00:00
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
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
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
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
Matt Kraai
d537a95fdb Use errorMsg rather than fprintf. 2000-07-14 01:51:25 +00:00
Eric Andersen
156959ea93 Fix uninitialized variable.
-Erik
2000-07-13 19:49:12 +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
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
Eric Andersen
0c838af50b Re-enable ln -n in the help.
-Erik
2000-07-11 17:38:27 +00:00
Eric Andersen
195fa15caf Another patch from Matt Kraai <kraai@alumni.carnegiemellon.edu>:
>
> The following patch allows ln -n to function like GNU.  It also fixes a
> typo with my previous patch to add support for ln FILE DIRECTORY.  And
> it removes some code that checks the maximum length of the filenames.  I
> can't figure out why that code is necessary.  Anyone know?
>
> Matt
2000-07-11 17:35:32 +00:00
Eric Andersen
c674d70699 Comment on kernel stuff
-Erik
2000-07-10 22:57:14 +00:00
Eric Andersen
9b2297a34e Remove yet more kernel header dependancies.
-Erik
2000-07-10 20:08:44 +00:00
Eric Andersen
a0053735dc Remove unused variable.
-Erik
2000-07-10 20:08:09 +00:00
Eric Andersen
0b4551faf5 From Matt Kraai <kraai@alumni.carnegiemellon.edu>:
Howdy,

Bug #1006 reports that

ln -s /tmp/foo .

does not work correctly.  In fact, it appears that any instantiation of

ln -s FILE... DIRECTORY

does not work.  The following patch adds support for this form, which
then fixes the particular instance noted in the bug report.

In the process, I needed the basename function.  This appears in the
string.h provided by glibc, but not uC-libc.  So I wrote my own to go in
utility.c, called get_last_path_component.  I also modified the basename
utility to use this function.

At some point it might be desirous to use the basename from the library
if it exists, and otherwise compile our own.  But I don't know how to do
this.

Matt
2000-07-10 16:44:03 +00:00
Eric Andersen
a03d86cf54 Patch from Matt Kraai <kraai@alumni.carnegiemellon.edu>:
GNU tr complains on the following:

$ tr a ''
tr: when not truncating set1, string2 must be non-empty

BusyBox tr does not complain:

$ tr a ''
a
^D
0

It should result in an error, not in some spurious output.  The attached
patch generates an error.

Matt
2000-07-10 16:38:50 +00:00
Eric Andersen
999bf72f49 More portability updates. Now compiles cleanly vs glibc, libc5, and uclibc
(except for mkfs_minix and fsck_minix -- and it doesn't yet link vs uclibc due
to missing stuff in the library).
 -Erik
2000-07-09 06:59:58 +00:00
Eric Andersen
bd22ed8067 Update files to reduce dependance on kernel version...
-Erik
2000-07-08 18:55:24 +00:00
Eric Andersen
5d893b6beb Remove MAXNAMLEN and use BUFSIZ instead.
-Erik
2000-07-06 01:57:20 +00:00
Eric Andersen
89bc256c94 Remove misguided klude around for 2.4.x-test* brokenness. Al Viro
will be removing this stuff from /proc/mounts real soon now I am assured.
 -Erik
2000-07-05 19:29:59 +00:00
Eric Andersen
f7cf2f7ef9 * Fix to tr so it recognizes standard escape sequences. Merged common
escape seq. code from tr and echo into utility.c.  Fix thanks to
    Matt Kraai <kraai@alumni.carnegiemellon.edu>.
* This should close Bug #1015.  Please test.
 -Erik
2000-07-05 17:26:35 +00:00
Eric Andersen
7c31ea4e29 Added support for ignoring '-g' per GNU ls, thanks to David Vrabel
<dvrabel@arcom.co.uk>.  Seems some ftp clients expect the '-g' option
to exist.
 -Erik
2000-07-03 14:55:49 +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
Eric Andersen
1386e70210 Fixed segfault with 'cut -f 1 -d:' and added 'cut -s' suport.
Fix thanks to Arne Bernin <arne@matrix.loopback.org>
 -Erik
2000-06-26 12:14:30 +00:00
Eric Andersen
10dc9d4d17 Updates to handle Linux 2.4.0 kernels (kludged around the "none" entries in
/proc/mounts, added a hack to make sysinfo work with both old and new kernels).
 -Erik
2000-06-26 10:45:52 +00:00
Eric Andersen
6f9985e2f2 Pavel Roskin <proski@gnu.org> just found a nasty memory
corruption bug.  Disabling 'ln -n' till it is fixed.
 -Erik
2000-06-22 00:02:56 +00:00
Eric Andersen
addc9c28ad Document 'ln --'
-Erik
2000-06-21 22:53:24 +00:00
Eric Andersen
b7362e36a8 printf now compiles cleanly under both libc5 and libc6.
-Erik
2000-06-19 17:52:17 +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
Pavel Roskin
110fc0cacc Check for 3 and more arguments was incorrect
It is only allowed for linking to a directory
But linking to a directory still fails and may be removed
2000-06-18 00:02:24 +00:00
Pavel Roskin
2e965239ee ln: fixed command line parser. Added support for "--" 2000-06-15 18:04:40 +00:00
Pavel Roskin
e97da40079 Fixed "rm foo" that had been broken while implementing "rm -- foo" 2000-06-14 17:39:41 +00:00
Eric Andersen
2b6ab3cbf8 Add new apps md5sum uudecode uuencode, fix some minor formatting things.
-Erik
2000-06-13 06:54:53 +00:00
Eric Andersen
a42982e8f5 * Fixed 'swapon -a' and 'swapoff -a', which were broken.
* Fixed 'mount -a' so it works as expected.
* Implemented 'ls -R' (enabled by enabling BB_FEATURE_LS_RECURSIVE)
 -Erik
2000-06-07 17:28:53 +00:00
Eric Andersen
1f6262b8e2 Fix 'date -u'
-Erik
2000-06-06 22:17:43 +00:00
Eric Andersen
815e904470 Fixed a bunch of stuff:
* Fixed segfault caused by "touch -c"
	* Fixed segfault caused by "rm -f"
	* Fixed segfault caused by "ln -s -s" and similar abuses.
	* Fixed segfault caused by "cp -a -a" and similar abuses.
	* Implemented "rm -- <foo>"
updated docs accordingly.
 -Erik
2000-06-06 16:15:23 +00:00
Eric Andersen
46a38dbb9b Don't allow mkfifo to create files such as "--help"
This patch checks if the name of FIFO to be created begins with "-" and
calls usage() if it does.

Regards,
Pavel Roskin
2000-06-04 05:17:35 +00:00
Eric Andersen
5a0a2aa00b Fix touch so it behaves itself (it could segfault in some cases).
Fix uname help info formatting.
 -Erik
2000-06-02 23:26:44 +00:00