Commit Graph

695 Commits

Author SHA1 Message Date
Rob Landley
23b61be0df Add comments to all the functions in this file documenting what they're for. 2006-08-04 20:20:03 +00:00
Rob Landley
2c55fcac08 Thinko spotted by Vladimir Dronnikov. 2006-08-04 05:24:58 +00:00
Rob Landley
081e38483e Remove xcalloc() and convert its callers to xzalloc(). About half of them
were using "1" as one of the arguments anyway, and as for the rest a multiply
and a push isn't noticeably bigger than pushing two arguments on the stack.
2006-08-03 20:07:35 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Rob Landley
df822f2606 We need xsetuid() and xsetgid() because per-user process resource limits can
prevent a process from switching to a user that has too many processes, and
when that happens WE'RE STILL ROOT.  See http://lwn.net/Articles/190331/
2006-07-15 23:00:46 +00:00
Mike Frysinger
83169c607b Tito writes: If the gecos field of an user is empty, obscure reports a false "similar to gecos" error. 2006-07-15 03:59:00 +00:00
Rob Landley
1f9145c5c3 More minor tweaks. 2006-07-12 21:31:16 +00:00
Mike Frysinger
58dda84ecc decuddle () from for/if/while 2006-07-12 20:04:00 +00:00
Rob Landley
c9c1a41c58 A couple things that got tangled up in my tree, easier to check in both than
untangle them:

Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the
signal list to that required by posix (they can specify the numbers for
the rest if they really need them).  (This is preparatory cleanup for adding
a timeout applet like Roberto Foglietta wants.)

Export the itoa (added due to Denis Vlasenko, although it's not quite his
preferred implementation) from xfuncs.c so it's actually used, and remove
several other redundant implementations of itoa and utoa() in the tree.
2006-07-12 19:17:55 +00:00
Rob Landley
ab7d9be17c Patch from Tito to remove pwd_to_spwd (which we don't actually need), with
some #ifdef removal from me.
2006-07-11 16:19:17 +00:00
Rob Landley
22d3958d76 Denis Vlasenko spotted the lack of bounds checking in my first attempt at
itoa/utoa.
2006-07-11 00:44:36 +00:00
"Robert P. J. Day"
5d8843e451 Replace current verbose GPL stuff in libbb/*.c with one-line GPL boilerplate. 2006-07-10 11:41:19 +00:00
Rob Landley
5b88a38157 Add itoa and utoa to see what Denis Vlasenko thinks. 2006-07-10 07:41:34 +00:00
Rob Landley
9ebd1bd468 Attempt to address Shaun Jackman's problem adding "busybox: busybox.bflt" to
.config.mak.
2006-07-06 20:02:47 +00:00
"Robert P. J. Day"
c9f423a93d Correct the comment to match the code. 2006-07-02 19:52:52 +00:00
"Robert P. J. Day"
63fc1a9e08 Standardize on the vi editing directives being on the first line. 2006-07-02 19:47:05 +00:00
"Robert P. J. Day"
087b9d640e Allow a user-configurable minimum password length. 2006-07-02 18:35:39 +00:00
"Robert P. J. Day"
edd9ca5743 More removal of "#if 0" content. 2006-07-01 14:52:12 +00:00
"Robert P. J. Day"
68229837ff Remove all usage of the "register" storage class specifier. 2006-07-01 13:08:46 +00:00
Rob Landley
8bbdb8732f This kind of paranoia is a debug option at best. 2006-06-30 16:36:56 +00:00
Rob Landley
a6e6037219 Fix bug http://bugs.busybox.net/view.php?id=874 where hexdump -C got its
spacing wrong.
2006-06-28 14:36:50 +00:00
Rob Landley
22f383e695 Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top. 2006-06-27 18:14:12 +00:00
Rob Landley
a892bf8284 Whitespace. (Vim's auto-indent is kind of annoying at times, like "daytime"
and "nighttime"...)
2006-06-25 15:37:28 +00:00
Rob Landley
934da82913 Fix a possible race condition if two processes try to claim the same loop
device at the same time.  We should only CLR_FD if the set status fails,
not if the SET_FD fails.
2006-06-25 15:29:12 +00:00
Rob Landley
c983274565 The logic to make cp -d or -P treat things like regular files should only
trigger for symlinks, not for device nodes.  This should fix "cp -a /dev ."
to work as expected (when run by root, anyway).

While I was there, cleanup headers and make an #ifdef go away...
2006-06-24 21:27:36 +00:00
Rob Landley
8437ede6c2 The type changed too. 2006-06-20 16:43:05 +00:00
Peter Kjellerstedt
5ab8f7de4f Use the new names for tty_baud_to_value() and tty_value_to_baud() again. 2006-06-20 16:35:37 +00:00
Rob Landley
57c1f73dd5 Revert the last two patches to go back to a state before this file was
controversial.
2006-06-20 16:17:24 +00:00
Rob Landley
290fcb4213 Undo all of the ugliness and some of the bloat from 15412. 2006-06-18 23:59:03 +00:00
Rob Landley
ea224be6aa skip_whitespace() shouldn't claim its return value is const, it doesn't know
that and callers wind up typecasting it back.
2006-06-18 20:20:07 +00:00
Mike Frysinger
b000586d02 danf writes: stty doesn't support baud rates > 460800 bps, the attached patch adds support for all baud rates supported by Linux 2.6.16 on x86. 2006-06-17 22:41:28 +00:00
Rob Landley
d9a761d9c3 Revert svn 15333. If you vfork, you must either exec or exit. (The parent is
blocked until you do so.)
2006-06-16 16:35:53 +00:00
Rob Landley
c7ddefc062 Attempt at fixing bug 815 by upgrading bb_spawn() so that builtins are at
the start of the path.  (This should be under the same config option as
the standalone shell, but right now that's buried in the shell menu.)

Also add the ability to specify CONFIG_BUSYBOX_EXEC_PATH with /proc/self/exe
as an overrideable default.
2006-06-14 01:24:33 +00:00
Rob Landley
18958e9309 Random cleanup of platform.h. 2006-06-13 18:28:33 +00:00
Bernhard Reutner-Fischer
2d1a6e7c1f - fix bug #887, in bb_get_chomped_line_from_file(), the last char was removed
unconditionally, even if it was not a newline.
  This was apparently broken by r14254
- whitespace while at it.
2006-06-10 11:04:43 +00:00
Paul Fox
6ab037872f made "test" an ash built-in.
moved the contents of libbb/bb_echo.c back into coreutils/echo.c,
which is a more reasonable place for them than libbb.  this
forces anyone who wants echo and test to be builtin to ash to
also have them available as applets.  their cost is very small,
and the number of people who wouldn't want them as applets is
also very small.

added warning about shell builtins vs. CONFIG_FEATURE_SH_STANDALONE_SHELL,
which conflicts with their use.

thanks to nathanael copa for debugging help.

some string size optimization in test.c may have been lost with
this commit, but this is a good new baseline.
2006-06-08 21:37:26 +00:00
Mike Frysinger
6fb5847faf sometimes daemonizing and vfork()/exit() is ok 2006-06-07 21:48:30 +00:00
Mike Frysinger
ca70774293 bb_xdaemon() isnt available on no-mmu systems 2006-06-07 21:47:34 +00:00
Mike Frysinger
373af43bb0 comment all fields 2006-06-07 21:37:59 +00:00
Mike Frysinger
301ad67912 add reference to proc(5) 2006-06-07 20:24:34 +00:00
Bernhard Reutner-Fischer
19008b8373 - reuse strings and messages. Saves about 600B 2006-06-07 20:17:41 +00:00
Mike Frysinger
828d6bb3bc whitespace 2006-06-07 20:04:13 +00:00
Mike Frysinger
62a2c15376 whitespace 2006-06-07 20:03:13 +00:00
Bernhard Reutner-Fischer
f9437aaf5b - make getopt_ulflags aware of CONFIG_GETOPT_LONG 2006-05-31 14:12:51 +00:00
Bernhard Reutner-Fischer
f3ac9ebc8e - convert xcalloc(1,x) to xzalloc 2006-05-31 13:31:16 +00:00
Bernhard Reutner-Fischer
c418d482ba - s/defined(__uClinux__)/BB_NOMMU/
This needs a second pass to:
+ add bb_daemon(unsigned char no_chdir, unsigned char no_close, const char*flag)
+ eventually globally export argc and argv, so we don't need to pass it to
  bb_daemon().
2006-05-31 10:19:51 +00:00
Rob Landley
bba7f08d27 Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
2006-05-29 05:51:12 +00:00
Rob Landley
8bb50782a5 Change llist_add_* to take the address of the list rather than returning the new
head, and change all the callers.
2006-05-26 23:44:51 +00:00
Rob Landley
5edc10275e Slight sanity fix: data is void *, not char *. And it's called data
almost everywhere, so be consistent.
2006-05-26 23:00:10 +00:00
Bernhard Reutner-Fischer
781e42d66c - introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).
- fix last.c to also look at the double-underscore UT_ defines.
2006-05-26 14:41:40 +00:00
Bernhard Reutner-Fischer
76b82cfd6f - make find_mount_point conditional on df and eject; Fixes `make hosttools´ on
hosts where mntent.h does not exist.
2006-05-26 13:38:43 +00:00
Mike Frysinger
4f93a63467 errno and h_errno values are not the same #876 by rfelker 2006-05-26 01:56:42 +00:00
Rob Landley
399d2b5c24 Rich Felker suggested removing dprintf() from watch, and one thing led to
another... This adds bb_xspawn() support, which does vfork/exec.  (I don't
know why using a static instead of a local adds ~40 bytes, but using
the local doesn't work...)
2006-05-25 23:02:40 +00:00
Rob Landley
80b8ff07ca A pending item in my tree I might as well check in: I plan to migrate calloc()
and bb_calloc() calls to bb_xzalloc() which allocates prezeroed memory but
only takes one argument (the size).
2006-05-19 20:36:49 +00:00
Bernhard Reutner-Fischer
b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Bernhard Reutner-Fischer
0a8812bdc5 - replace _PATH_DEVNULL with bb_dev_null 2006-05-19 13:12:21 +00:00
Bernhard Reutner-Fischer
38583fd6f2 - use uint32_t instead of __u32
Thanks to Rich Felker for pointing this out.
2006-05-19 12:44:16 +00:00
Bernhard Reutner-Fischer
a2a647dfc1 - include strings.h
Thanks to Rich Felker for pointing this out.
2006-05-19 12:30:00 +00:00
Bernhard Reutner-Fischer
e2e56c7c41 - single KERNEL_VERSION(a,b,c) macro in platform.h
- rename get_kernel_revision() to get_linux_version_code
from Robert P. J. Day
2006-05-19 11:54:02 +00:00
Rob Landley
34b5319d86 Make md5 calculation always go through an the buffer so that A) we don't
handle packets out of sequence if some data goes through the buffer and
some doesn't, B) it works on systems that can't handle aligned access,
C) we just have one code path to worry about.

While we're at it, sizeof() and RESERVE_CONFIG_BUFFER() really don't combine
well, which is why md5sum has been reading and processing data 4 bytes at a
time.  I suspect that the existence of CONFIG_MD5_SIZE_VS_SPEED to do loop
unrolling and such in the algorithm was an attempt to work around that bug.
2006-05-16 02:38:26 +00:00
Bernhard Reutner-Fischer
2f38f27b42 - patch from Robert P. J. Day to use filter instead of findstring. 2006-05-15 10:04:50 +00:00
Mike Frysinger
39440e520c pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:09 +00:00
Rob Landley
f7897ec47b Autodetect parts of a multipart file, from Robert P. Day's suggestion. 2006-05-12 01:42:33 +00:00
Rob Landley
cc848ddbf8 Bug fix from Vladimir Oleynik, and suggestion I add my copyright notice
to the file.
2006-05-11 18:25:24 +00:00
Rob Landley
a6b5b60942 Fiddling with llist to make memory management easier. Specifically, the
option to delete the contents of the list when we delete the list is a
good thing.
2006-05-08 19:03:07 +00:00
Rob Landley
0ea0aefcb5 Remove a link that leaked in from the pending llist_t changes. 2006-05-08 15:08:25 +00:00
Rob Landley
a389651115 Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
2006-05-07 20:20:34 +00:00
Rob Landley
2c39eee805 Migrate endianness macros. 2006-05-05 16:54:40 +00:00
Rob Landley
552b56dfd1 Not quite compiler independent, but we've never tried to be gcc independent
anyway.  This is at least less ugly than what was there before, and fixes
building all sources at once.
2006-05-04 21:22:27 +00:00
Rob Landley
f76cd964ec Whitespace and documentation cleanup from Dennis Vlasenko. 2006-05-03 21:23:15 +00:00
Rob Landley
7818a422bc Portability tweak from Shaun Jackman, don't include asm/page.h directly. 2006-04-25 18:42:23 +00:00
Rob Landley
bbd50b58ea Remove some #if 0 code. 2006-04-18 20:42:39 +00:00
Bernhard Reutner-Fischer
54f75ee300 - BusyBox is under GPL.
in http://www.busybox.net/lists/busybox/2006-April/020364.html Denis Vlasenko
  said when asked which license to use for these files:
  "Sure. LGPL or GPL is fine with me."
  Adjusting accordingly.
2006-04-18 08:24:13 +00:00
Mike Frysinger
1a54030445 use memmove() instead of bcopy() 2006-04-16 05:58:21 +00:00
Mike Frysinger
78bd504947 use memcmp() not bcmp() 2006-04-16 05:51:47 +00:00
Bernhard Reutner-Fischer
c2cb0f32b4 - patch from Denis Vlasenko to add and use bb_xopen3() 2006-04-13 12:45:04 +00:00
Bernhard Reutner-Fischer
d9cf7ac781 - patch from Denis Vlasenko to add and use bb_xchdir() 2006-04-12 18:39:58 +00:00
Bernhard Reutner-Fischer
67f641e75b - patch from Denis Vlasenko to add bb_xbind() and bb_xlisten() 2006-04-12 18:24:37 +00:00
Bernhard Reutner-Fischer
2c99851181 - patch from Denis Vlasenko to add and use bb_xdaemon() 2006-04-12 18:09:26 +00:00
Bernhard Reutner-Fischer
dac7ff15b7 - patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it.
  Also use shorter boilerplate while at it.
2006-04-12 17:55:51 +00:00
Bernhard Reutner-Fischer
cb44816ba3 - add and use bb_opendir(), bb_xopendir().
text    data     bss     dec     hex filename
 889445    9392 1035784 1934621  1d851d busybox.gcc-4.2.orig
 889297    9392 1035784 1934473  1d8489 busybox.gcc-4.2
 889009    9820 1037860 1936689  1d8d31 busybox.gcc-4.1.orig
 888817    9820 1037860 1936497  1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Rob Landley
c57ec37959 Patch from Rob Sullivan to consolidate crc32 table generation. 2006-04-10 17:07:15 +00:00
Bernhard Reutner-Fischer
fa939aae81 - include proper headers. 2006-04-05 16:21:37 +00:00
Bernhard Reutner-Fischer
421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Rob Landley
a13cca9cf4 New version from Tito. 2006-04-02 18:57:20 +00:00
Bernhard Reutner-Fischer
d409c3a2f7 - Rich Felker writes: fix invalid printf format strings
http://busybox.net/lists/busybox/2006-March/019568.html

   text	   data	    bss	    dec	    hex	filename
 900619	  10316	1038724	1949659	 1dbfdb	busybox.oorig
 900603	  10316	1038724	1949643	 1dbfcb	busybox
2006-03-29 22:34:47 +00:00
Rob Landley
ca087713f2 More extern removal from Robert P. Day. 2006-03-29 16:52:56 +00:00
Bernhard Reutner-Fischer
cb8d4319a3 find ./ -name .cvsignore | xargs svn rm 2006-03-29 15:51:19 +00:00
Mike Frysinger
f885513940 just whitespace fixes 2006-03-28 02:35:56 +00:00
Rob Landley
3570915769 More dead code removal. 2006-03-26 21:49:42 +00:00
Rob Landley
1bb31928d5 Bug spotted by Stephane Billiart: losetup depends on loop.c. 2006-03-23 16:49:22 +00:00
Rob Landley
fb3a631310 Very nice patch from Rich Felker to portably set the stream error indicator and
thus remove a lot of nasty old code that didn't.
2006-03-23 15:30:26 +00:00
Rob Landley
8dd4ca787a Patch from Shaun Jackman to make loop.c build only when needed. 2006-03-21 16:22:19 +00:00
Bernhard Reutner-Fischer
263e75d051 - fix order of includes. 2006-03-18 11:59:55 +00:00
Rob Landley
aae8b3405e Whitespace cleanup and minor tweak (return -ERRNO instead of ERRNO so
EPERM doesn't register as a successful read-only mount.
2006-03-18 02:38:10 +00:00
Rob Landley
ea9a471acd Random in-passing tweak. 2006-03-16 14:40:27 +00:00
Rob Landley
31642d75e1 More "extern" removals from Robert P. Day 2006-03-14 21:45:38 +00:00
Rob Landley
386f85eadf Attempt to make a warning go away without increasing size. 2006-03-14 21:13:48 +00:00
Bernhard Reutner-Fischer
df10094870 - revert back to r14406 2006-03-13 19:04:00 +00:00