#define NOCCARGC #include stdio.h /* ** Close previously opened fd and reopen it. ** Entry: fn = Null-terminated CP/M file name. ** May be prefixed with letter of drive. ** May be just CON:, RDR:, PUN:, or LST: ** mode = "a" -append ** "r" -read ** "w" -write ** "a+" -append update ** "r+" -read update ** "w+" -write update ** Returns the original fd on success, else NULL. */ freopen(fn, mode, fd) char *fn, *mode; int fd; { if(fclose(fd)) return (NULL); if(_open(fn, mode, fd)==ERR) return (NULL); return (fd); }