home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / slackwar / tcl / tcl_tk_t / tclx7.3bl / tclx7 / tclX7.3b / osSupport / rename.c < prev    next >
Encoding:
Text File  |  1994-07-16  |  351 b   |  19 lines

  1. /* rename.c -- file renaming routine for systems without rename(2)
  2.  *
  3.  * Written by reading the System V Interface Definition, not the code.
  4.  *
  5.  * Totally public domain.  (Author unknown)
  6.  *
  7.  */
  8.  
  9. int rename(from,to)
  10. register char *from, *to;
  11. {
  12.     (void) unlink(to);
  13.     if (link(from, to) < 0)
  14.     return(-1);
  15.  
  16.     (void) unlink(from);
  17.     return(0);
  18. }
  19.