aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/putc.x
blob: 3021347dcc5124eeaa2542c18875e7c7c2a11851 (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
28
29
30
31
32
33
34
35
36
37
38
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

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

# PUTC -- Put a character to a file.

procedure putc (fd, ch)

int	fd			# output file
char	ch			# character to be output

int	and()
errchk	flsbuf
include	<fio.com>

begin
	if (iop[fd] < bufptr[fd] || iop[fd] >= otop[fd])
	    call flsbuf (fd, 0)

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

	if (ch == '\n')				# end of line of text?
	    if (and (FF_FLUSH, fflags[fd]) != 0)
		call flsbuf (fd, 0)
end


# PUTCHAR -- Put a character to the standard output.

procedure putchar (ch)

char	ch			# character to be output

begin
	call putc (STDOUT, ch)
end