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 / FPUTC.C < prev    next >
Text File  |  2000-06-30  |  640b  |  28 lines

  1.  
  2. #define NOCCARGC
  3. #include stdio.h
  4. #include clib.def
  5. extern int _status[];
  6. /*
  7. ** Character-stream output of a character to fd.
  8. ** Entry: ch = Character to write
  9. **        fd = File descriptor of pertinent file.
  10. ** Returns character written on success, else EOF.
  11. */
  12. fputc(ch, fd) int ch, fd; {
  13.   switch(ch) {
  14.     case EOF:   _write(CPMEOF, fd); break;
  15.     case '\n':  _write(CR, fd); _write(LF, fd); break;
  16.     default:    _write(ch, fd);
  17.     }
  18.   if(_status[fd] & ERRBIT) return (EOF);
  19.   return (ch);
  20.   }
  21.  
  22. #asm
  23. putc  equ fputc
  24.       entry putc
  25. #endasm
  26.  
  27.  
  28.