aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/nmireadb.x
blob: dc23866c991191fc5168d502c184adcbe0fbd5c3 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <nmi.h>


# NMI_READB -- Read a block of data stored externally in NMI format.
# Data is returned in the format of the local host machine.

int procedure nmi_readb (fd, spp, maxelem)

int	fd			#I input file
bool	spp[ARB]		#O receives data
int	maxelem			# max number of data elements to be read

pointer	sp, bp
int	pksize, nchars, nelem
int	nminelem(), read()
errchk	read()

long	note()

begin
	pksize = nminelem (maxelem, NMI_INT)
	nelem  = EOF

	# Read data into user buffer and unpack in place.
	nchars = read (fd, spp, pksize)
	if (nchars != EOF)
	    nelem = min (maxelem, pksize)

	return (nelem)
end