aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbfchp.x
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tbtables/tbfchp.x')
-rw-r--r--pkg/tbtables/tbfchp.x27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/tbtables/tbfchp.x b/pkg/tbtables/tbfchp.x
new file mode 100644
index 00000000..b88153d4
--- /dev/null
+++ b/pkg/tbtables/tbfchp.x
@@ -0,0 +1,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