home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / SMC21LIB.LZH / RENAME.C < prev    next >
Text File  |  2000-06-30  |  640b  |  27 lines

  1.  
  2. #define NOCCARGC
  3. #include stdio.h
  4. #include clib.def
  5. /*
  6. ** Rename a file.
  7. **  from = address of old filename.
  8. **  to = address of new filename.
  9. **  Returns NULL on success, else ERR.
  10. */
  11. rename(from, to) char *from, *to; {
  12.   char fcb[FCBSIZE];
  13.   pad(fcb, NULL, FCBSIZE);
  14.   if(!_newfcb(to, fcb) || _bdos(OPNFIL, fcb) != 255) {
  15.     _bdos(CLOFIL, fcb);
  16.     return (ERR);
  17.     }
  18.   if(_newfcb(from, fcb) &&
  19.      _newfcb(to, fcb+NAMEOFF2) &&
  20.      _bdos(RENAME, fcb) != 255)
  21.     return (NULL);
  22.   return (ERR);
  23.   }
  24.  
  25.   ,005,006,007,008,009,
  26.     010,011,012,013,014,015,016,017,018,019,
  27.     020,021,022,023,024,025,026,027,02