home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / SMALL_C / FPUTC.C < prev    next >
Text File  |  1987-10-04  |  640b  |  26 lines

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