aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/getci.x
blob: 64dd6f663abe8c72343eb57a4b66f4f711180003 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<config.h>
include	<fio.h>

# GETCI -- Get a character (passed as an integer) from a file.

int procedure getci (fd, ch)

int	fd			# input file
int	ch			# character (output)
int	filbuf()
errchk	filbuf
include	<fio.com>

begin
 	if (iop[fd] < bufptr[fd] || iop[fd] >= itop[fd])
	    if (filbuf(fd) == EOF) {
		ch = EOF
		return (EOF)
	    }

	ch = Memc[iop[fd]]
	iop[fd] = iop[fd] + 1

	return (ch)
end