Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!asuvax!mcdphx!mcdchg!ddsw1!karl From: karl@ddsw1.MCS.COM (Karl Denninger) Newsgroups: comp.unix.xenix Subject: Re: 'Rename' Library Function? Summary: Solution. Keywords: rename lib Message-ID: <1989Sep20.001435.28773@ddsw1.MCS.COM> Date: 20 Sep 89 00:14:35 GMT References: <[157]unix@oldcolo.UUCP> Reply-To: karl@ddsw1.MCS.COM (Karl Denninger) Organization: Macro Computer Solutions, Inc., Mundelein, IL Lines: 43 In article <[157]unix@oldcolo.UUCP> dave@oldcolo.UUCP (Dave Hughes) writes: >WHen I try to compile an indexing program written on a Mac (AIX I think) >system, which has a 'rename' library function, it bombs on that function, >returning an 'unresolved external' error on _rename. > >It is used - and needed - in the following type of use: > > char oldname[32], finalname[65]; > sprintf (oldname, "x%dk0", generation_number); > sprintf (finalname, "%s.k", doc_filename); > if (rename (oldname, finalname)) > printf ("Sorry -- error in renaming file %s to %s!\n", oldname, > finalname); > >I cannot find another 386 Xenix compiler library function which will >work in its place. Any suggestions? Sure Dave! Try this replacement: int rename(oname, fname) /* Returns zero if ok, NZ otherwise */ char *oname; char *nname; { if (link(oname, nname)) { /* Try to make a link */ perror("failed"); /* Something is wrong, complain */ return(1); /* Failed to make a link */ } return(unlink(oname)); /* Remove old name / return status */ } Include that somewhere and it should replace your missing function. Note that this will not work if the new name (fname) is on a different file system. (Ps: I noted that your message came from AKCS; glad to see you have the linkage working properly! :-)) -- Karl Denninger (karl@ddsw1.MCS.COM, !ddsw1!karl) Public Access Data Line: [+1 312 566-8911], Voice: [+1 312 566-8910] Macro Computer Solutions, Inc. "Quality Solutions at a Fair Price"