Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!ames!apple!agate!ucbvax!ucsfcgl!cca.ucsf.edu!root From: root@cca.ucsf.edu (Systems Staff) Newsgroups: comp.os.minix Subject: Re: Replacement for rename()? Summary: Some confusion here ... Message-ID: <2251@ucsfcca.ucsf.edu> Date: 26 Jul 89 01:39:50 GMT References: <20454@louie.udel.EDU> Organization: Computer Center, UCSF Lines: 39 In article <20454@louie.udel.EDU>, HELMER%SDNET.BITNET@vm1.nodak.edu (Guy Helmer) writes: > I've ported David Clunie's yacc to MINIX successfully except for > one problem: no obvious working replacement for rename() system -- issue a shell command (Section 3, Unix User's Manual) mv -- move or rename files (Section 1, Unix User's Manual) thus system("mv "); > I've tried using link(oldname, newname); unlink(oldname);, > but link() apparently doesn't like to work over mount points even > if the new file and old file are to exist on the same file system. I find this confusing: going over mount points appears to be the essence of different file systems. What do you mean here? It is correct for links (i.e. hard as opposed to symbolic links) not to connect between file systems. > The only thing that seems to be left to do is the equivalent > of 'cp ' and then unlink(oldname). Does anyone I presume this should be "" --------^^^^^^^ > have a better suggestion? Thanks in advance. The latter sequence is about equivalent to _mv_ for the case where the two names refer to different filesystems (mv also sets the time and date info on the new copy). Of course, as written the example is mixing program execution (cp) and library call (unlink). Thos Sumner Internet: thos@cca.ucsf.edu (The I.G.) UUCP: ...ucbvax!ucsfcgl!cca.ucsf!thos BITNET: thos@ucsfcca U.S. Mail: Thos Sumner, Computer Center, Rm U-76, UCSF San Francisco, CA 94143-0704 USA OS|2 -- an Operating System for puppets. #include