aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/iki/oif/oifupdhdr.x
blob: 516d62c1949957c7be5a9e6018f5db9590a4f593 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<syserr.h>
include	<error.h>
include	<imhdr.h>
include	<imio.h>
include	"oif.h"

# OIF_UPDHDR -- Update the image header.

procedure oif_updhdr (im, status)

pointer	im			#I image descriptor
int	status			#O return status

int	hfd
errchk	imerr, open, oif_wrhdr, flush
int	open()

begin
	status = OK
	hfd = IM_HFD(im)

	if (IM_ACMODE(im) == READ_ONLY)
	    call imerr (IM_NAME(im), SYS_IMUPIMHDR)
	if (hfd == NULL)
	    hfd = open (IM_HDRFILE(im), READ_WRITE, BINARY_FILE)

	call oif_wrhdr (hfd, im, TY_IMHDR)
	call flush (hfd)

	if (IM_HFD(im) == NULL)
	    call close (hfd)
end