[comp.lang.c] rm

jhall@wpi.WPI.EDU (John Clinton Hall) (02/17/91)

Where can I get the C source to rm (remove)?  Can I anon FTP it from somewhere?

-- 
The highest sounds are hardest to hear.  ## ## ## ##### ##  jhall@wpi.wpi.edu
Going forward is a way to retreat.       ## ## ## ## ## ##  Worcester
Great talent shows itself late in life.  ## ## ## ##### ##  Polytechnic
Even a perfect program still has bugs.   ######## ##    ##  Institute

gwyn@smoke.brl.mil (Doug Gwyn) (02/17/91)

In article <1991Feb16.192418.2361@wpi.WPI.EDU> jhall@wpi.WPI.EDU (John Clinton Hall) writes:
>Where can I get the C source to rm (remove)?  Can I anon FTP it from somewhere?

This really isn't the proper newsgroup for such queries.
However, the simple answer is that on many systems the "rm" utility
amounts to little more than passing the arguments one at a time to
the remove() or unlink() library function.  Command-line options add
a bit of complication, but that's the general idea.
It is quite likely that the source code for the utilities on your
particular system are protected by nondisclure provisions in license
agreements between the provider and your institution.  For such
reasons, code like that is not normally available for anonymous FTP.
You may be able to find a public-domain implementation somewhere..

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (02/18/91)

In article <1991Feb16.192418.2361@wpi.WPI.EDU>, jhall@wpi.WPI.EDU (John Clinton Hall) writes:
> Where can I get the C source to rm (remove)?

For which operating system?  (There _is_ more than one possible answer.)

main(argc, argv) int argc; char **argv; { extern int unlink();
while (*++argv) if (unlink(*argv)) { perror(*argv); exit(1); } exit(0); }

The rest is frills and error reporting.
(See rmdir(), readdir(), and getopt()).

-- 
Professional programming is paranoid programming

fischer@iesd.auc.dk (Lars P. Fischer) (02/19/91)

>>>>> On 16 Feb 91 19:24:18 GMT, jhall@wpi.WPI.EDU (John Clinton Hall) said:

John> Where can I get the C source to rm (remove)?  Can I anon FTP it
John> from somewhere?

IF you mean for a BSD-type Unix system AND IF you promise to ask such
questions on comp.sources.wanted in the future THEN you might like to
take a look at the GNU version of rm -- it has all the bells and
whistles you could possibly ask for. It's part of the GNU fileutils
package. Look at prep.ai.mit.edu.

/Lars
--
Lars Fischer,  fischer@iesd.auc.dk   | Beauty is a French phonetic corruption
CS Dept., Univ. of Aalborg, DENMARK. |                   - FZ