ftp.nice.ch/pub/next/unix/file/NeXT-ls.README

This is the README for NeXT-ls.N.bs.tar.gz [Download] [Browse] [Up]

A shlib-free ls for anonymous FTP
---------------------------------

Effective with NeXT Release 1.0, most executables are linked with
shared libraries.  This is in general a good thing, as it makes
executables much smaller, reduces physical memory requirements,
and facilitates code sharing.  Unfortunately, this "breaks"
anonymous FTP, since ftpd depends on an external ls image to
implement the LIST and NLST commands.  Anonymous ftp runs
chrooted to ~ftp for security reasons, but this makes /usr/shlib
unavailable.  One approach is to duplicate /usr/shlib/libsys_s_B.shlib
under ~ftp.  This consumes approximately half a megabyte of disk
space, and isn't really "shareable" as intended.  Since NeXT does
not provide a self-sufficient ls, I've provided my own based on
the redistributable ls 5.32 sources distributed by uunet.uu.net
and gatekeeper.dec.com.

This was harder than it "should" be:

1) I had to fix inexcusable bugs in Berkeley's code.  This is the
"Nth" one of their programs I've seen that hands bad pointers to
free().  I'm convinced that free() is a no-op on Berkeley's
development systems ... after all, it's all "virtual" memory,
"we" don't "really" have to "free" anything.  Bozos.

2) The code that implements the -f option is hopelessly broken.
At one point a function that takes no arguments (dodir) is called
with a string.  As written, ls requires an argument with -f
(which /bin/ls does not), which it then ignores (which it isn't
supposed to).  Since this is not really needed for anonymous FTP,
I have NOT fixed this.  This does preclude this version from
being a full ls replacement, since it has some niceties, like
better error messages.

3) The code assumed that printf() returns the number of
characters actually output.  This is not the case for NeXT 1.0
(or for "true" 4.3).  It is, however, true for SunOS, HP/UX,
A/UX, ...  The fix makes some horrible assumptions.

4) stat() counts blocks in 512-byte increments, but ls thinks in
terms of 1K blocks.  I put in a lot of /2s that I don't feel
particularly good about, instead of doing something intelligent
like calling statfs() to find out what's really going on.

5) There were some functional differences between the versions,
I've attempted to make things look as much as possible like the
old one.

6) The "new" BSD is going to look a lot more like System V.
   You'll see what I mean...

>>> ALL changes are under #if[n]def NeXT conditionals except in
the Makefile.


Eric P. Scott
San Francisco State University
<eps@sutro.sfsu.edu>
11/13/1989

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.