Commit Graph

194 Commits

Author SHA1 Message Date
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
c61852a02b fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)
2006-11-29 11:09:43 +00:00
Denis Vlasenko
cf30cc82a3 header_verbose_list: stop truncating file size in listing 2006-11-24 14:53:18 +00:00
Denis Vlasenko
fcdb00f735 httpd: LC_TIME locale _must_ be POSIX to httpd! We speak over the net! 2006-11-21 00:09:37 +00:00
Denis Vlasenko
656f746e74 ls: silly comment fixes 2006-10-28 13:02:55 +00:00
Denis Vlasenko
94cf69fe3e ls: cleanup part 2. ifdef forest is much less scary now :) 2006-10-28 12:37:51 +00:00
Denis Vlasenko
5c7596058d ls: cleanup part 1 2006-10-28 12:37:16 +00:00
Denis Vlasenko
c6f188def8 silly size savings and capitalization fixes 2006-10-26 00:37:00 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +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
2b8a05a775 I broke allbareconfig with half-finished cleanups I'd forgotten weren't done.
Got both to a decent stopping point.  (There's a lot more cleanup to do on ls.c
but now is not the time...)
2006-06-20 17:43:01 +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
Rob Landley
9947a244d4 Patch from Rich Felker:
- duplicated format bit 14 forced LIST_EXEC always-on
- -p option was behaving just like -F (SUSv3 says -p only shows / for
  dirs, not other special symbols)
- tests for LIST_EXEC in color functions were nonsense (constant
  tests). i assume they were supposed to be (all_fmt & LIST_EXEC)
  however having coloring of executable files depend on -F seems
  undesirable.
2006-06-15 22:11:10 +00:00
Bernhard Reutner-Fischer
d2c306e862 - ls: remove unused variable
- dpkg.c, diff: use xstat
   text    data     bss     dec     hex filename
 848823    9100  645216 1503139  16efa3 busybox_old
 848679    9100  645216 1502995  16ef13 busybox_unstripped
bloatcheck is completely useless as it sees -79 for this, which is bogus.
2006-05-29 12:10:23 +00:00
Rob Landley
c44bc986b7 Fix some warnings in allbareconfig. 2006-05-28 01:19:06 +00:00
Rob Landley
425e7584a4 Patch from Rich Felker to make ls use libc's qsort. 2006-05-03 20:22:03 +00:00
Rob Landley
2631486f1b Patch from Shaun Jackman:
ls has an ugly bug. ls uses an array of pointers, the elements of
which are all in a linked list. To free the elements, instead of
freeing all the elements in the array, array[0..nelements], it frees
by iterating the linked list starting at array[0], which it assumes is
the head of the list. Unfortunately, ls also sorts the array! So,
array[0] is no longer the head, but somewhere in the middle of the
linked list. This patch fixes this bug, and also adds an
ENABLE_FEATURE_CLEAN_UP stanza.
2006-05-02 19:46:52 +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
c5b1d4d6b1 Patch from Denis Vlasenko to add xstat() and use it. 2006-03-13 15:45:16 +00:00
Rob Landley
dfba741457 Robert P. Day removed 8 gazillion occurrences of "extern" on function
definitions.  (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
Rob Landley
08abe64d91 Selinux fix from Jan Kiszka. 2006-03-01 20:48:44 +00:00
Eric Andersen
5e678873f9 clean up yet more annoying signed/unsigned mismatches and fixup
yet more incorrect types
2006-01-30 19:48:23 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
"Vladimir N. Oleynik"
1f0262bcdb another more const 2005-10-20 11:17:48 +00:00
Bernhard Reutner-Fischer
d5bd137a24 - rename libbb's password helpers as suggested in libbb.h
my_getpwnam -> bb_xgetpwnam  /* dies on error */
  my_getgrnam -> bb_xgetgrnam  /* dies on error */
  my_getgrgid -> bb_getgrgid
  my_getpwuid -> bb_getpwuid
  my_getug    -> bb_getug
2005-09-20 21:06:17 +00:00
Rob Landley
b7128c6236 Cleanup patch by Bernhard Fischer, removing unnecessary includes of
getopt.h, whitespace changes, typos, etc.
2005-09-11 01:05:30 +00:00
"Vladimir N. Oleynik"
a8c23aa795 - usage fresh bb_getopt_ulflags for ls -- very size reduce.
- small indent corrections
- remove unecessary malloc and free
2005-09-05 15:06:57 +00:00
Paul Fox
156dc41cbc commiting patch from bug 71:
0000071: patch: implement "--color" option for ls coloring control
2005-08-01 19:33:30 +00:00
Rob Landley
60158cb93e A patch from Takeharu KATO to update/fix SE-Linux support. 2005-05-03 06:25:50 +00:00
Glenn L McGrath
afc9ab8686 Patch from David Daney to make the -i option work with -l. 2004-09-24 02:04:13 +00:00
Eric Andersen
52499cb9ae Tito writes:
Hi,
I've spent the half night staring at the devilish  my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've  found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and  logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
     false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
     The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
     Maybe this buffers can be reduced a bit  ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
     size busybox
       text    data     bss     dec     hex filename
     239568    2300   36816  278684   4409c busybox
    size busybox_fixed
       text    data     bss     dec     hex filename
     239616    2300   36816  278732   440cc busybox
7) The behaviour of whoami changed:
    actually it  prints out an username cut down to the size of the buffer.
    This could be fixed by increasing the size of the buffer as in id.c or
    avoid the use of my_getpwuid and use getpwuid directly instead.
    Maybe this colud be also remain unchanged......

Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
Eric Andersen
4f807a84c5 BusyBox has no business hard coding the number of major and minor bits for a
dev_t.  This is especially important now that the user space concept of a dev_t
and the kernel concept of a dev_t are divergant.  The only bit of user space
allowed to know the number of major and minor bits is include/sys/sysmacros.h
(i.e. part of libc).  When used with a current C library and a 2.6.x kernel,
this fix should allow BusyBox to support wide device major/minor numbers.
 -Erik
2004-07-26 09:11:12 +00:00
Eric Andersen
70060d25d2 s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
2004-03-27 10:02:48 +00:00
Eric Andersen
97310d0253 Brian Pomerantz writes:
I've noticed a bug in the "autowidth" feature more, and is probably in
others.  The call to the function get_terminal_width_height() passes
in a file descriptor but that file descriptor is never used, instead
the ioctl() is called with 0.  In more_main() the call to
get_terminal_width_height() passes 0 as the file descriptor instead of
fileno(cin).  This isn't a problem when you more a file (e.g. "more
/etc/passwd") but when you pipe a file to it (e.g. "cat /etc/passwd |
more") the size of the terminal cannot be determined because file
descriptor 0 is not a terminal.  The fix is simple, I've attached a
patch for more.c and get_terminal_width_height.c.


BAPper
2004-03-23 23:15:36 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Manuel Novoa III
1117c5281b Fix broken sort order flags. 2004-03-08 10:54:29 +00:00
Glenn L McGrath
c4db0833a6 Patch from Matt Kraai to fix debian bug number 231994.
There was an extra blank line preceding the first directory.
2004-03-06 09:12:55 +00:00
Eric Andersen
d07cf59a98 Vladimir N. Oleynik writes:
Hi, Glenn.

Current CVS "ls" applet have small problem: some options
ignoring. Last patch attached ;-)


--w
vodz
2004-02-05 13:52:03 +00:00
Glenn L McGrath
65b6d8bdb6 Fix a bug where ls -le would print the time twice. 2004-01-18 05:41:30 +00:00
Glenn L McGrath
792cae5f2a Use bb_getopt_ulflags, save 200-300 bytes 2004-01-18 05:15:16 +00:00
Eric Andersen
6d687817a8 Fix oversight with CONFIG_FEATURE_AUTOWIDTH handling 2003-11-04 23:16:48 +00:00
Eric Andersen
8efe967018 Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles.
 -Erik
2003-09-15 08:33:45 +00:00
Eric Andersen
b7ebc61b54 Michael Sternberg writes:
Latest BusyBox from CVS (Jul 7 2003).
    File coreutils/ls.c
    "if" at line 970 should be enclosed in #ifdef CONFIG_FEATURE_LS_SORTFILES
    "if" at line 976 should be enclosed in #ifdef CONFIG_FEATURE_LS_TIMESTAMPS
2003-07-14 19:20:46 +00:00
Eric Andersen
9e48045e45 Patch from Russell Coker:
I've attached my latest SE Linux patch for busybox against the latest CVS
    version of busybox.
2003-07-03 10:07:04 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Eric Andersen
fc4a0fd82e last_patch75_2 from vodz, 2003-01-14 18:13:13 +00:00
Glenn L McGrath
4d00129d0f Correct column width for tab completion and ls 2003-01-06 01:11:50 +00:00
Aaron Lehmann
a170e1c858 Change if(x)free(x); to free(x); 2002-11-28 11:27:31 +00:00
Glenn L McGrath
8e027f6474 Use printf instead of fprintf(stdout 2002-11-28 08:37:46 +00:00
Glenn L McGrath
e3906fcd94 Run through indent, fix BB_ define 2002-08-22 18:13:54 +00:00
Eric Andersen
d598d41110 Fix silly combinitorial oversight 2002-04-27 09:19:39 +00:00
Eric Andersen
5f6873621d ls could mis-color certain entries when previous commands
had failed.  Explicitly 0 out errno to prevent that.
2002-04-17 20:21:45 +00:00
Eric Andersen
3ad0bd9563 Patch from J.W.Janssen <JanWillem.Janssen@lxtreme.nl> to provide
color ls support, modifed by me to behave properly when not running
output to a terminal (i.e. 'ls | more')
 -Erik
2002-03-20 09:13:48 +00:00
Matt Kraai
a1bbde71bf list_single: Declare scratch iff CONFIG_FEATURE_LS_USERNAME is defined. 2002-03-08 16:25:33 +00:00
Matt Kraai
3bd31ebc9a * fileutils/ls.c (showfiles): Display multiple short names on a line. 2002-03-08 16:16:38 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
bb9579ffc3 Make formatting match GNU ls (we were including a spare ' ')
-Erik
2001-07-31 22:43:50 +00:00
Eric Andersen
8d79ce8320 Some patches to make dietlibc work... 2001-07-22 23:00:15 +00:00
Eric Andersen
20aab260e2 Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly.  I also adjusted Config.h for
uClinux so it will automagically disable apps the arn't going to
work without fork() and such.
 -Erik
2001-07-19 22:28:02 +00:00
Eric Andersen
7e516797f9 Pad the human readable output for 'ls -sh' to 6 chars, since we will
have numbers printed as XXX.YU, so we need 6 digits not 4.
 -Erik
2001-06-30 18:00:26 +00:00
Manuel Novoa III
a77cfbfd0c ls -s was reporting bytes instead of blocks. 2001-06-30 07:46:50 +00:00
Eric Andersen
24982c589b Fix up some warnings that show up on ppc 2001-06-25 19:31:48 +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
Eric Andersen
77d9268892 Patch from larry to fix some grammar errors. 2001-05-23 20:32:09 +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
Matt Kraai
782ab3ccf8 Simplify pathname building, in which a bug was noted by Larry Doolittle,
a patch was provided by Vladimir Oleynik, and am improved patch commited
by me.
2001-04-23 01:07:00 +00:00
Eric Andersen
250a221768 more FILE_OFFSET_BITS == 64 adjustments. 2001-04-05 23:26:44 +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
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
c835567914 Fix ls so it uses make_human_readable_str() the same way already
used by 'du' and 'df'.  Now we just need to fix make_human_readable_str
so it behaves they way it used to before Matt fixed it.
2001-03-28 20:26:51 +00:00
Mark Whitley
9a2144663a Applied patch from David Douthitt to fix problem where ls reports half the
file size. Should close bug #1140.
2001-03-27 20:59:14 +00:00
Eric Andersen
3e6ff9017f A cleanup patch from Jeff Garzik to static-ify a number of
namespace polluting things that really should be static.
2001-03-09 21:24:12 +00:00
Mark Whitley
ae5612ca6e Some minor cleanups to df.c. Also, with Erik's blessing, changed name of
'format' function to 'make_human_readable_str'.
2001-03-07 17:42:07 +00:00
Eric Andersen
651f8c04ef Fix up ls.c to ensure human readable works properly in all cases 2001-03-07 03:48:02 +00:00
Eric Andersen
8b728a25a3 I made these little simplifications a while back, bug forgot to
check this stuff in.
 -Erik
2001-03-06 23:14:43 +00:00
Eric Andersen
f1142c5b11 Oops. Put time.h after busybox.h, so we can check for BB_FEATURE_LS_TIMESTAMPS
-Erik
2001-02-20 06:16:29 +00:00
Eric Andersen
cbe31dace5 It turns out that DODMALLOC was broken when I reorganized busybox.h
header file usage before the 0.49 release.  To fix it, I had to move
the '#include "busybox.h"' to the end of the list of #include files.
 -Erik
2001-02-20 06:14:08 +00:00
Eric Andersen
81bcc92c32 Fixed 'ls -s' so it actually displays block sizes again.
-Erik
2001-02-15 18:59:02 +00:00
Eric Andersen
67991cf824 This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
2001-02-14 21:23:06 +00:00
Mark Whitley
9b300d0b1f Buglet: 'tabstops' is unused if BB_FEATURE_AUTOWIDTH is not defined. 2001-02-01 19:39:43 +00:00
Eric Andersen
30f64c3aa2 Fix a stupid typo -- bug found by Larry Doolittle. 2001-01-30 19:23:46 +00:00
Eric Andersen
e57d54b456 Fix ls behavior for broken or very narrow terminals. Fix my_*
functions so they comply with the original interface (i.e. don't
exit on error, stringify uids and gids when no amtching name found).
 -Erik
2001-01-30 18:03:11 +00:00
Eric Andersen
ed3ef50c23 Fix header file usage -- there were many unnecessary header files included in
busybox.h which slowed compiles.  I left only what was needed and then fixed up
all the apps to include their own header files.  I also fixed naming for pwd.h
and grp.h functions.  Tested to compile and run with libc5, glibc, and uClibc.
 -Erik
2001-01-27 08:24:39 +00:00
Eric Andersen
a528dc7071 Fix my braindamage -- remove termios and sighandling since they are not
needed at all.  My bad.
 -Erik
2001-01-26 18:30:12 +00:00
Eric Andersen
1e4b957ac3 I am an idiot. Looking over my patch, ls doesn't need to do anything
more then the ioctl to get the win size.   None of the termios handling
crap is needed.
 -Erik
2001-01-26 18:09:13 +00:00
Eric Andersen
5c9c8b4b26 Make cin be static 2001-01-26 06:50:46 +00:00
Eric Andersen
5307eca7de Make ls understand termios.
-Erik
2001-01-26 01:52:43 +00:00
Eric Andersen
f5d5e77321 more bugs fixed -- found doing regression testing
-Erik
2001-01-24 23:34:48 +00:00
Mark Whitley
59ab025363 #define -> static const int. Also got rid of some big static buffers. 2001-01-23 22:30:04 +00:00
Richard June
6d0921cc0b Add HUMAN_READABLE define for -m and -h support in du, df, and ls
Add support for -k in du, df, and ls(no define, it's for compatibliity with the GNU utils as bb does -k by default)
Fix bug #1084
2001-01-22 22:35:38 +00:00
Matt Kraai
12f417edbd Eliminate calls of the form "fprintf(stdout,". Thanks for the idea to
Vladimir N. Oleynik.
2001-01-18 02:57:08 +00:00
Matt Kraai
1fa1adea2a Change calls to error_msg.* and strerror to use perror_msg.*. 2000-12-18 03:57:16 +00:00
Eric Andersen
bd193a42a5 Fix from Matt Kraai -- a better way to NULL terminate strings for the
my_* passwd and group routines.  I should have thought of doing it
this way...
2000-12-13 01:52:39 +00:00
Mark Whitley
f57c944e09 Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
2000-12-07 19:56:48 +00:00
Matt Kraai
3e856ce428 Stop using TRUE and FALSE for exit status. 2000-12-01 02:55:13 +00:00
Eric Andersen
cf1189f5a7 Patch from Matt Kraai to fix an infinate loop with ls -aR 2000-11-29 21:52:06 +00:00