Glenn L McGrath
cfeb08a193
Make sure there is a trailing '\0' when extracting to buffer.
2001-07-13 17:59:48 +00:00
Glenn L McGrath
5e66a26eaa
Dont setvbuff in here, must be called just after stream is initialised, glibc tolerates using it later, uclibc doesnt
2001-07-13 06:51:56 +00:00
Glenn L McGrath
b028e08d35
Move setvbuf calls from gz_open() to calling functions, setvbuf is only supposed to be called prior to opening the stream, glibc tolerates later use, uclibc doesnt.
2001-07-13 06:43:03 +00:00
Eric Andersen
7467c8d3b6
Patch from vodz:
...
Changed email address
cmdedit API change
optimizations for traceroute and md5sum
added a new shared create_icmp_socket() function
2001-07-12 20:26:32 +00:00
Glenn L McGrath
3e94f729a5
Quiet mode, sometimes error messages arent wanted
2001-07-12 10:24:57 +00:00
Glenn L McGrath
c127008840
Allow unarchive to redirect stdout (tobe used by dpkg applet)
2001-07-11 17:32:14 +00:00
Glenn L McGrath
481d19b38e
Fix bug where it wasnt returning the last line of a multiline field
2001-07-11 15:43:03 +00:00
Glenn L McGrath
daf0b78e1a
Reverse part of my previous changes
2001-07-11 15:32:52 +00:00
Glenn L McGrath
93febe672a
free coniditionally, just to make it play nice with dmalloc which is incompatable with standard free()
2001-07-11 07:25:01 +00:00
Glenn L McGrath
248c57ca43
minor dmalloc inspired cleanups
2001-07-11 07:22:17 +00:00
Eric Andersen
5a071bcbf2
Avoid a segfault (detected by Fabio Ferrari
...
<fabio.ferrari@digitro.com.br> in the wget applet) when
concat_path_file() or last_char_is() were fed a NULL.
-Erik
2001-07-07 04:27:35 +00:00
Matt Kraai
5009f90ea2
Removed obsolete function, strdup_substr.
2001-07-05 19:00:47 +00:00
Eric Andersen
8e75f6daa6
Fix a stupid thinko, and fix killall to cope with the updated
...
find_pid_by_name() interface
-Erik
2001-07-05 16:27:34 +00:00
Eric Andersen
d50a61956c
Implement suggestion from Adam Slattery, (don't default to killing closing bug #1190 .
2001-07-05 15:56:36 +00:00
Eric Andersen
0159597bd6
Generalize comment -- no longer ls specific
2001-06-30 18:08:36 +00:00
Manuel Novoa III
d877d44d12
All-integer version (but it does use an unsigned long long) which fixes
...
the problems of the previous version (used floating point, overflowed, didn't
round properly). The comments at the top of the file are worth reading;
especially note 2 concerning "ls -sh".
2001-06-30 07:40:44 +00:00
Manuel Novoa III
a2949aa217
Add some missing includes to kill warnings when building with the default
...
Config.h and using gcc's -fno-builtin. There are probably other files
with the similar problems.
Also, if building against uClibc, don't include asm/unistd.h in syscalls.c
and module_syscalls.c.
2001-06-29 18:59:32 +00:00
Eric Andersen
029b4a0422
Allow xrealloc to act as a free() when size=0, per SuS2.
...
-Erik
2001-06-28 21:22:19 +00:00
Eric Andersen
0d8cc1670c
Fix a type promotion bug discivered and analyzed by Alan Modra
...
<amodra@bigpond.net.au>, which caused false checksum errors
2001-06-27 06:15:50 +00:00
Eric Andersen
91a6318d55
Make it so we don't segfault when /proc isn't mounted -- guess pid 1...
...
-Erik
2001-06-26 22:44:09 +00:00
Eric Andersen
5ef5614c31
Don't use void * to pass pointers of known type
2001-06-26 16:36:26 +00:00
Glenn L McGrath
78b0e379d7
Vladimir's last_patch_15
2001-06-26 02:06:08 +00:00
Glenn L McGrath
2e6d3cfa82
Nore unarchive (and doc) fixes from Laurence Anderson
2001-06-24 12:36:54 +00:00
Glenn L McGrath
8f5b63edea
cpio applet, and changes to associated code
2001-06-22 09:22:06 +00:00
Matt Kraai
a0105713e8
Remove obsolete function declaration.
2001-06-22 04:20:24 +00:00
Eric Andersen
764303f980
stdlib.h defined free(), which this needs
2001-06-22 03:07:19 +00:00
Eric Andersen
30f1eafaaa
Fix the build process so it does not do the evil #ifdef BB_FOO stuff.
...
Build exactly one .o file per function, and let the linker throw away
the junk it doesn't want.
-Erik
2001-06-22 03:00:21 +00:00
Eric Andersen
6b03504441
Add in a missing header file
2001-06-22 02:58:45 +00:00
Glenn L McGrath
76ce7549ce
Dont change date or chmod on symlinks, lchown on symlinks if lchown available
2001-06-22 02:55:16 +00:00
Glenn L McGrath
9f832deecf
remove defines around unarchive, its always used
2001-06-22 02:27:55 +00:00
Tim Riker
837097648e
comment cleanup
2001-06-22 00:27:11 +00:00
Tim Riker
fbbd360b3c
create_path -> make_directory
2001-06-22 00:14:20 +00:00
Matt Kraai
ceeff73819
Rewrote mkdir (and touched lots of things in the process).
2001-06-21 19:41:37 +00:00
Glenn L McGrath
eb1c94078f
Reorganise unarchiving functions, more code re-use, only does single pass(no more linked lists), basis for supporting a cpio (and cheaper untar) applet, but cpio applet isnt included in this.
...
It effects ar, dpkg-deb applets only
2001-06-20 07:48:00 +00:00
Eric Andersen
32574a41b4
With a bit of care I was able to save about 100 bytes.
...
-Erik
2001-06-15 20:10:39 +00:00
Glenn L McGrath
6bad1fa1fd
This isnt used anymore, replaced by seek_sub_file() in ./libbb/deb_extract.c
2001-06-15 03:13:00 +00:00
Eric Andersen
f429baca86
I reworked make_human_readable_str so it now has a sane interface,
...
and then fixed up df, du, and ls to use the new interface. I also
fixed up some formatting issues in ls while I was in there.
-Erik
2001-06-13 08:02:45 +00:00
Glenn L McGrath
17822cd60a
Reorganise unarchive functions, new files, removed some
2001-06-13 07:34:03 +00:00
Glenn L McGrath
9aff903603
Reorganise archive extraction code
2001-06-13 07:26:39 +00:00
Matt Kraai
bf0a010cf7
Copy files until EOF, not the reported file size, to deal with bad sizes in
...
the proc filesystem.
2001-06-11 13:58:02 +00:00
Matt Kraai
5246225596
Add padding to struct sysinfo needed by m68k (note and patch by Richard
...
Hirst).
2001-06-08 13:57:27 +00:00
Eric Andersen
8b113f93b9
Vladimir's last_patch13, containing several bugfixes.
2001-06-01 21:47:15 +00:00
Eric Andersen
77d9268892
Patch from larry to fix some grammar errors.
2001-05-23 20:32:09 +00:00
Matt Kraai
774d135b66
Make more robust (patch by Larry Doolittle).
2001-05-23 14:45:09 +00:00
Matt Kraai
d6ef07406d
Rewrote copyfd to use library functions, terminate, and copy correct data.
2001-05-18 14:14:55 +00:00
Matt Kraai
231f998aba
Switch from hstrerror to herror for libc5 systems.
2001-05-17 14:19:05 +00:00
Matt Kraai
8f7a4ad442
Add missing include, noted by Larry Doolittle.
2001-05-16 17:05:03 +00:00
Matt Kraai
c55b8d41c1
Add xgethostbyname and herror_msg* functions.
2001-05-16 15:40:51 +00:00
Eric Andersen
55f9872616
This patch from Adam Heath <doogie@debian.org>, makes print_file
...
(used by cat, grep, sed, etc) quite a bit faster.
2001-05-15 17:48:09 +00:00
Eric Andersen
c911a4389b
Patch from Vladimir:
...
1) fixed a bug that could crash df, mount, and umount applets if the root
device name was longer then the word "root" (/dev/loop1 vs /dev/root) -
2) severl functions needed static declaration in the umount applet
3) update declaration for function in last_char_is() in libbb
2001-05-15 17:42:16 +00:00
Eric Andersen
14d354312a
Per suggestion from Vladimir, eliminate check_wildcard_match(), which
...
was only being used by insmod these days.
Also, I spent a minute adjusting insmod so that it first searches
/lib/modules/`uname -r` and then (if that fails) searches /lib/modules,
which makes bb insmod behave much more like the real insmod, and should
avoid nasty surprises (such as the recent "Modutils vs. Busybox..."
thread).
-Erik
2001-05-14 17:07:32 +00:00
Eric Andersen
5f265b755a
Fix a segfault in lash, hush, and cmdedit. Each of these used
...
xgetcwd, but did not check the return for a NULL, and then continued
to call strlen on the NULL when the cwd had been removed from under it.
-Erik
2001-05-11 16:58:46 +00:00
Matt Kraai
f3e79ba6e3
Fix symlink removal problem noted by Erik Andersen.
2001-05-11 02:35:36 +00:00
Eric Andersen
8cd16d8fd3
This syncs things with Vladimir's latest patches. Also gets
...
rid of useless 'const int' declarations.
-Erik
2001-05-07 23:11:23 +00:00
Eric Andersen
186bf1defc
This is Vladimir's update to last_char_is(). Since 'char *' is
...
the least common denominator, I modified it to use that (not const),
which will minimize the need for casting elsewhere.
2001-05-07 23:10:16 +00:00
Eric Andersen
f3f9f3efa7
A patch from Vladimir to simplify chomp()
2001-05-07 23:02:39 +00:00
Eric Andersen
4ad13e5d95
A patch from Vladimir to simplify concat_path_file() and
...
make it less likely to break.
2001-05-07 23:01:32 +00:00
Eric Andersen
28355a36da
Per some comments from Lars Kellogg-Stedman <lars@larsshack.org>,
...
make xreadlink() return NULL on failure, and make sure everyone
uses the interface correctly.
-Erik
2001-05-07 17:48:28 +00:00
Glenn L McGrath
6b8c550d88
include libbb.h after other includes
2001-05-05 03:19:12 +00:00
Eric Andersen
044a72d0d5
Larry suggested using concat_path_file() would be an even safer bet
...
for 'which'. I ageed, so I whipped this up -- which revealed a bug in
concat_path_file. It turns out that that a '/' can be appended from
either the path _or_ the filename, but only the former was checked.
-Erik
2001-05-04 22:04:24 +00:00
Eric Andersen
0e9aef36fa
Oops. I was a bit too hasty and also changed applet_name.
2001-04-30 18:18:02 +00:00
Mark Whitley
8a633268ef
Made new xreadlink function for libbb and changed applets to use it instead of
...
readlink(2).
2001-04-30 18:17:00 +00:00
Eric Andersen
6f34394454
These messages can be .rodata, so make them even more const.
...
-Erik
2001-04-30 18:08:03 +00:00
Matt Kraai
218aa370b4
Fix user permissions of copied directories.
2001-04-30 17:32:43 +00:00
Matt Kraai
43ca13714b
Simplify permission handling for FIFOs.
2001-04-30 16:43:21 +00:00
Matt Kraai
24abecc349
Fix exit status when there is an error copying a file.
2001-04-30 16:37:04 +00:00
Matt Kraai
72ab975a6b
Terminate source correctly when copying symlink. Report and patch by
...
Brian Webb <webbb@desertscenes.net>.
2001-04-27 15:40:27 +00:00
Eric Andersen
c1bdffe99b
Another nice cleanup from Larry. This adds a new last_char_is() function and
...
uses it to avoid possible buffer underruns whn strlen is zero, and avoid the
possible space-hogging inline of strlen() in several cases.
-Erik
2001-04-26 15:56:47 +00:00
Mark Whitley
c29c44c00e
libbb.h now includes ../busybox.h. This way, files in libbb that have
...
BB_[FEATURE] #defines won't be ignored. Credit to Magnus Damm for spotting
this.
2001-04-25 18:06:21 +00:00
Mark Whitley
4f3558af17
Fixed a BB_MTAB #define buglet reported by Magnus Damm.
2001-04-25 17:03:40 +00:00
Eric Andersen
04095e58fb
Move messages.c to libbb. Make each string in messages.c be its own .o file.
...
This way, we can new get rid of all that tedious #define rubbish we used to
need to enable specific messages. This way is enormously simpler, and as a
bonus also ends up saving us 96 bytes.
-Erik
2001-04-25 05:39:18 +00:00
Matt Kraai
8810bdbba3
Rewrote rm.
2001-04-24 20:04:18 +00:00
Matt Kraai
01441036e9
Use generic flag names.
2001-04-24 01:30:02 +00:00
Matt Kraai
9ff9325e60
Move applet_name declaration from busybox.h to libbb.h.
2001-04-24 01:12:33 +00:00
Matt Kraai
91b2855ba8
Rewrite cp and mv to be SUSv2 compliant.
2001-04-23 18:53:07 +00:00
Mark Whitley
4e9267d76c
Reversed last patch; unnecessary.
2001-04-23 17:56:27 +00:00
Mark Whitley
4b66dabc76
Added a sanity check to fix weird bug exposed when sourcing in commands from a
...
file with lash. Based on report from Heinz Walter.
2001-04-23 17:04:41 +00:00
Glenn L McGrath
f5c358bc98
Simplify file_prefix handling, and use of *dir variable.
2001-04-23 13:52:02 +00:00
Glenn L McGrath
ee0d93ed04
Fix horrible, horrible memmory leak. I wondered why processes were dying !
2001-04-21 10:26:15 +00:00
Glenn L McGrath
89dc02d944
Clearly define out exclude list code, as recommended by Larry Doolittle
2001-04-21 02:12:13 +00:00
Glenn L McGrath
6ebd633829
Set permissions of created file
2001-04-20 05:16:38 +00:00
Eric Andersen
46cd74b9e3
This has two patches. First it moves interface.c to libbb (it is
...
support code after all). It also contains a patch from Larry Doolittle
that removes two instances of "strlen([^)]*) *- *1", un-shadows two
variables, relaxes requirement for a sprintf(3) that returns number of
bytes written, and eliminates a duplicate subroutine.
2001-04-19 16:55:27 +00:00
Eric Andersen
0a3bda2c53
Move real_loop.h to libbb, where it belongs.
...
-Erik
2001-04-18 22:23:22 +00:00
Eric Andersen
b5ec61e4f5
Add types for the inline funcs, thanks to Ralph Siemsen <ralphs@netwinder.org>
2001-04-18 20:17:05 +00:00
Matt Kraai
b181056e06
Eliminated seeks so that we work correctly on pipes, and removed reliance on
...
undefined evaluation ordering. Thanks to Anthony Towns for explanation and
solution.
2001-04-18 14:49:55 +00:00
Glenn L McGrath
33431ebb9a
dpkg improvements, use full package struct, avoid extracting to tmp dir, rename variable.
...
deb_extract, untar and dpkg_deb modified to make the above possible
2001-04-16 04:52:19 +00:00
Glenn L McGrath
685f5fd6f4
untar changed to allow deb_extract to extract to memory, allows better operation of dpkg-deb -f
2001-04-15 12:51:59 +00:00
Glenn L McGrath
5faef74bae
Reads a field from a debian control (status or available) file, handles multi-line fields.
2001-04-15 12:38:12 +00:00
Glenn L McGrath
65708e4cd1
Read a FILE* till an empty line or eof and return it as a char buffer.
...
In future maybe add char *end_str to interface to allow calling function
to specify end point.
2001-04-15 12:36:19 +00:00
Glenn L McGrath
445fb952b8
dpkg-deb -f and partial -I commands, adds 600 bytes
2001-04-13 04:02:57 +00:00
Matt Kraai
1e04ea388f
Fix dos2unix/tr problem noted by Larry Doolittle.
2001-04-12 21:38:06 +00:00
Glenn L McGrath
5a65413c04
Updates, fixes for handling contents, verbose extract.
...
More updates to come
2001-04-12 16:40:21 +00:00
Glenn L McGrath
3e2ab88ee2
New dpkg-deb function -t, stands for --fsys-tarfile
2001-04-12 13:49:09 +00:00
Glenn L McGrath
c9cac5be23
Change size to unsinged long long, so if -1 is passed it will read as much as possible.
2001-04-12 13:47:12 +00:00
Glenn L McGrath
6785b51280
dpkg-deb -c works now
2001-04-12 11:48:02 +00:00
Glenn L McGrath
359c106871
Fix dpkg-deb, enum's are cool
2001-04-12 10:19:08 +00:00
Glenn L McGrath
46079a1d77
remove unused clearerr statements
2001-04-12 10:17:22 +00:00
Glenn L McGrath
327175137f
This belongs in dos2unix.c
2001-04-12 02:29:34 +00:00
Glenn L McGrath
a283157c38
convert() is used by dos2unix and unix2dos
2001-04-12 00:49:26 +00:00
Glenn L McGrath
c8d9e0604a
Moved from dos2unix
2001-04-12 00:42:53 +00:00
Glenn L McGrath
b3f23d4c6a
Seek to start of an entry inside an ar file
2001-04-11 16:31:20 +00:00
Glenn L McGrath
4949faf4b2
copy_file_chunk uses streams now.
2001-04-11 16:23:35 +00:00
Glenn L McGrath
5b20d02ea9
This is primarily to allow deb_extract to be independent of the tar applet.
...
TODO: This function and its conterpart in tar.c should be merged
2001-04-11 16:14:24 +00:00
Glenn L McGrath
9e966ffed4
Remove unneeded printf statment
2001-04-11 15:11:48 +00:00
Glenn L McGrath
f70f6cef39
Disable sigterm
2001-04-11 15:09:30 +00:00
Glenn L McGrath
7fd92949d0
Move unzip, gz_open, gz_close to libbb
2001-04-11 03:11:33 +00:00
Glenn L McGrath
d22e560ad6
Move deb_extract() to libbb, dpkg now independent of dpkg-deb
2001-04-11 02:12:08 +00:00
Glenn L McGrath
9d53c8ab74
Move get_ar_headers to libbb, make dpkg_deb.c independent of ar.c
2001-04-11 01:37:03 +00:00
Eric Andersen
0958093be6
Doc update for the 0.51 release.
...
-Erik
2001-04-10 20:10:55 +00:00
Eric Andersen
fd402941a7
Patch from Valdimir to reduce stack usage, since recursive_action
...
is (as the name implies) is recursive, reducing stack memory usage
is important to avoid exhausting available stack memory.
2001-04-10 17:53:49 +00:00
Eric Andersen
b6b519b416
Update how we detect if libc5 is in use.
...
-Erik
2001-04-09 23:52:18 +00:00
Eric Andersen
e5dfced23a
Apply Vladimir's latest cleanup patch.
...
-Erik
2001-04-09 22:48:12 +00:00
Eric Andersen
250a221768
more FILE_OFFSET_BITS == 64 adjustments.
2001-04-05 23:26:44 +00:00
Eric Andersen
83f173b61e
A first pass at making D_FILE_OFFSET_BITS=64 work, from
...
Jari Ruusu <jari.ruusu@pp.inet.fi>
2001-04-05 23:07:25 +00:00
Eric Andersen
831ed16efc
Handle glibc 2.0.7 as well
2001-04-05 22:38:32 +00:00
Eric Andersen
911af57ff8
Be more generic for libc5. We don't need to know struct definitions
...
to make the syscall finction -- use a generic pointer instead.
2001-04-05 07:41:51 +00:00
Eric Andersen
64c8b1762c
Another iteration -- adjust the init_module syscall a bit.
...
-Erik
2001-04-05 07:33:10 +00:00
Eric Andersen
acc7757312
*** empty log message ***
2001-04-05 06:24:28 +00:00
Eric Andersen
a2a978ae23
Some further syscall adjustments. Split the module syscalls out of
...
insmod and into libbb. Only enable them for libc5. glibc and
uClibc don't need them.
-Erik
2001-04-05 06:08:14 +00:00
Eric Andersen
e76c3b08e1
A number of cleanups. Now compiles with libc5, glibc, and uClibc. Fix a few
...
shadowed variables. Move (almost) all syscalls to libbb/syscalls.c, so I can
handle them sanely and all at once.
-Erik
2001-04-05 03:14:39 +00:00
Eric Andersen
3c0364f391
Patch from Larry Doolittle to eliminate needless thrashing
...
about when trimming long strings with lots of trailing white
space.
2001-04-04 22:49:01 +00:00
Eric Andersen
14fe392dde
Fix a warning with libc5.
...
-Erik
2001-04-04 19:26:22 +00:00
Eric Andersen
b2e3e9b0c9
Seems that stupid libc5 doesn't implement daemon(), so conditionally
...
inclde that here.
-Erik
2001-04-04 19:25:57 +00:00
Eric Andersen
91c9388715
Place a temporary bandaid on the ls/du/df human-readable issue. This method is
...
not going to scale up as well as I would like, and Matt Kraai and I have
discussed a better long term solution. But for now this will at least make all
the human-readable apps give correct answers.
Please test the human readable/non-human readable options on your systems!!!
-Erik
2001-04-03 23:14:29 +00:00
Eric Andersen
60b2d8d2c8
if strlen(s) was 0, it would then end up using s[-1] as an array index. Bad,
...
bad, bad. This was crashing the shell on powerpc boxes, though all other archs
seem to have a much more forgiving malloc implementations. I finally found
this bug using electric-fence on a powerpc box.
-Erik
2001-04-03 22:50:52 +00:00
Eric Andersen
c4cef5ab06
Move the mtab support stuff into libbb
...
-Erik
2001-04-01 16:01:11 +00:00
Matt Kraai
d98e574d41
Patch bass ackwards behavior of hr flag.
2001-03-28 20:10:25 +00:00
Matt Kraai
7cd0cfeab6
Rewrite to fix bug #1140 and make it slightly smaller.
2001-03-28 16:42:27 +00:00
Eric Andersen
08ff8a49ba
includes cleanup from Jeff Garzik
2001-03-23 17:02:05 +00:00
Eric Andersen
1ca20a7747
A nice patch from Larry Doolittle that adds -Wshadow and
...
cleans up most of the now-revealed problems.
2001-03-21 07:34:27 +00:00
Eric Andersen
b183dfad2d
Split error messages into separate files.
...
Update libbb.h, per suggestion from Vladimir, to include __attribute__((format
(printf ...))) stuff
-Erik
2001-03-19 19:24:06 +00:00
Eric Andersen
c75586e06d
Split libbb/pwd_grp_wrappers.c into 5 different libbb/my_* files.
...
-Erik
2001-03-19 18:37:42 +00:00
Eric Andersen
1a6f8cfadf
update .cvsignore files to note new location of loop.h
2001-03-17 00:15:02 +00:00
Eric Andersen
8a6dbf6709
Patch from Pierre PEIFFER <pierre.peiffer@sxb.bsf.alcatel.fr>
...
that copes with the fact that processes may have been swapped
out.
2001-03-17 00:05:42 +00:00
Eric Andersen
aad1a88c76
Convert utility.c into libbb.a. It is now a whole pile of .c
...
files. Clean up the resulting damage and fix up the makefile.
-Erik
2001-03-16 22:47:14 +00:00
Eric Andersen
19f86207f5
Update the build system for pristine source directory builds. This
...
update is primarily work done by Larry Doolittle, but I did some
touchups of my own to make it work for me,
-Erik
2001-02-17 00:42:47 +00:00
Eric Andersen
624cc771da
More portable handling of loop header files, as done in util-linux
2000-09-21 02:04:51 +00:00