home *** CD-ROM | disk | FTP | other *** search
-
- #include stdio.h
- #include clib.def
- extern int _chrpos[];
- /*
- ** Character-stream input of one character from fd.
- ** Entry: fd = File descriptor of pertinent file
- ** Returns the next character on success, else EOF.
- */
- fgetc(fd) int fd; {
- int ch;
- while(1) {
- switch(ch = _read(fd)) {
- default: return (ch);
- case CPMEOF: switch(_chrpos[fd]) {
- default: --_chrpos[fd];
- case 0:
- case BUFSIZE:
- }
- _seteof(fd);
- return(EOF);
- case CR: return('\n');
- case LF: /* NOTE: _conin() maps LF -> CR*/
- }
- }
- }
- #asm
- getc equ fgetc
- entry getc
- #endasm