*BSD News Article 67571


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!news.vbc.net!news.cais.net!newsfeed.internetmci.com!news.mathworks.com!fu-berlin.de!news.belwue.de!news.uni-stuttgart.de!news.rhrz.uni-bonn.de!saph2.physik.uni-bonn.de!juengst
From: juengst@saph1.physik.uni-bonn.de (Henry G. Juengst)
Newsgroups: comp.unix.misc,comp.unix.bsd.misc
Subject: Re: How to delete files within C programs
Date: 3 May 1996 14:11:36 GMT
Organization: Institut fuer Strahlen- und Kernphysik
Lines: 48
Sender: juengst@saph2.physik.uni-bonn.de (Henry G. Juengst)
Distribution: world
Message-ID: <4md46o$1bk@news.rhrz.uni-bonn.de>
References: <Oum-El-Kheir.Benkahla-3004961724540001@mac-ugm-3.imag.fr> <4m5p3k$3nq@dfw-ixnews2.ix.netcom.com> <4m7sr3$rf9@news.rhrz.uni-bonn.de> <DqtDDy.Hrq@metapro.DIALix.oz.au>
Reply-To: juengst@saph1.physik.uni-bonn.de
NNTP-Posting-Host: saph1.physik.uni-bonn.de
Xref: euryale.cc.adfa.oz.au comp.unix.misc:22392 comp.unix.bsd.misc:902


In article <DqtDDy.Hrq@metapro.DIALix.oz.au>, bernie@metapro.DIALix.oz.au (Bernd Felsche) writes:
>In <4m7sr3$rf9@news.rhrz.uni-bonn.de>
>  juengst@saph1.physik.uni-bonn.de (Henry G. Juengst) writes:
>
>>In article <4m5p3k$3nq@dfw-ixnews2.ix.netcom.com>, SolutionWorks <solwork@popd.ix.netcom.com> writes:
>>>Very simple solution, use the 'unlink' system function to delete files
>
>>This might be a simple solution if you know the solution, but why should
>>a beginner know that the function to delete a file is not something like
>>'delete_file', but 'unlink' in the unix mud ? 
>
>Nothing stops you from defining delete_file to be like unlink if you
>prefer the larger amount of typing. unlink() won't actually delete the
>file .. it removes one link from the inode and the corresponding
>directory entry [ coincidentally, the space allocated to the inode is
>released when the link count goes to zero ]. So delete_file is a
>misnomer in that sense.

The question was not how to redefine a function name. The person was
looking for the function name. It is not so easy to see that 'unlink'
removes files (or directory entries). The OS interal implementation
is irrelevant for beginners.

>
>All of my *important* files have spare links in "hidden" directories
>to catch stray "rm *" commands. ;-)
>
>There is of course no single system call under conventional Unix which
>deletes files... but that doesn't stop you from writing a function which
>tries to do it.

You know what happens if a beginner tries to write such a function...

>-- 
>Bernd Felsche {speaking for himself}
>MetaPro Systems Pty Ltd, 130 Fauntleroy Avenue,
>Redcliffe, Western Australia 6104
>Phone: +61 9 479 3722    Fax: +61 9 479 3720

Henry

--
juengst@saph1.physik.uni-bonn.de         [131.220.161.1]  (Internet)
omni:.de.uni-bonn.physik.saph1::juengst                   (DECnet/OSI, phase V)
saph1::juengst                           [26.358]         (DECnet, phase IV)

Any opinions in this mail are my own.