aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/iki/ikidelete.x
blob: a172980b1b473656826635623b6fb145822931fa (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
39
40
41
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<syserr.h>
include	"iki.h"

# IKI_DELETE -- Delete an image or group of images.

procedure iki_delete (image)

char	image[ARB]		#I name of image

int	k, status
pointer	sp, root, extn
int	iki_access()
bool	fnullfile()

errchk	syserrs
include	"iki.com"

begin
	if (fnullfile (image))
	    return

	call smark (sp)
	call salloc (root, SZ_PATHNAME, TY_CHAR)
	call salloc (extn, MAX_LENEXTN, TY_CHAR)

	# Verify that the image exists and determine its type.
	k = iki_access (image, Memc[root], Memc[extn], 0)
	if (k < 0)
	    call syserrs (SYS_IKIAMBIG, image)
	else if (k == 0)
	    call syserrs (SYS_IKIIMNF, image)

	# Delete the image.
	call zcall4 (IKI_DELETE(k), k, Memc[root], Memc[extn], status)
	if (status == ERR)
	    call syserrs (SYS_IKIDEL, image)
	
	call sfree (sp)
end