[BusyBox] PATCH: HTML output from ls

Mark Whitley markw at lineo.com
Fri Mar 23 00:27:01 UTC 2001


On Wed, Mar 21, 2001 at 02:26:55PM +1100, Leigh Dyer wrote:

[snipped: patch to make ls output HTML]

> This patch is mainly to get feedback - does anyone else see a need for
> this?

Here's the short answer: No way is this patch going in.

Here's the long answers:

If a feature doesn't exist in the equivalent GNU tools, it really shouldn't
exist in Busybox either. GNU ls, doesn't do HTML output, so neither will
Busybox ls. Furthermore, -H is already used in GNU ls for a variant of 'human
readable', so we wouldn't want to add a flag that behaves differently.

One of the core Unix Philosophies is "do one thing and do it well". Now, I'll
grant you that ls as currently constituted goes a good ways beyong doing the
"one thing" of listing files: it appends characters to files or colors them to
denote what kind of file it is, it does doing tabular listings, it performs
size conversions, it sorts in a myriad of ways, and oodles of other things.
(The motto for the GNU tools would probably be something more along the lines
of: "Do one thing and do it _thoroughly_" :-) To date, all those extra
features in ls have provided a large enough convenience to a large enough
audience to justify their existince. The patch you submitted really goes way
outside of ls's core domain and its usefulness is limited to a very small
group (i.e. just you).

That's why this patch doesn't belong in the Busybox source. There are several
better ways to accomplish what you need:

 - Use sed to get the job done, that's the "one thing" that it does well. I'm
   a little surprised that you need a "massive regex" to accomplish this, the
   following one-liner should do the trick:

   	ls -1 | sed -e 's/\(.*\)/<a href="\1">\1<\/a>/'

 - Implement the dir listing code in micro_httpd, as you mentioned. This seems
   like the right place to do it.


I hope this explanation helps. We're happy to get contributions, but we do
need to set some limits.


Mark Whitley
markw at lineo.com





More information about the busybox mailing list