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
/
FGETC.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
768b
|
31 lines
#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