aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbfchp.x
blob: b88153d43b39b86ba06720265270f7b20cad7137 (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
include "tbtables.h"

# tbfchp -- chop rows off the end of a FITS table
# This routine deletes rows at the end of a table.
#
# Phil Hodge,  6-Mar-1998  Subroutine created.

procedure tbfchp (tp, ndel)

pointer tp		# i: pointer to table descriptor
int	ndel		# i: number of rows to be deleted
#--
int	nrows		# number of rows in the table before deleting
int	status
errchk	tbferr

begin
	nrows = TB_NROWS(tp)

	status = 0
	call fsdrow (TB_FILE(tp), max (1, nrows-ndel+1), ndel, status)
	if (status > 0)
	    call tbferr (status)

	# Change the value of TB_NROWS.
	TB_NROWS(tp) = max (0, nrows - ndel)
end