aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbcnam.x
blob: 9c0ab180443baabb3c53f16e67d756e0c8ca6349 (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
include <tbset.h>
include "tbtables.h"

# tbcnam -- change column name
# This procedure replaces the column name.  The column descriptor is
# updated, and if the table is not read-only the modified descriptor
# is also written back into the table.
#
# Phil Hodge, 19-Oct-1989  allow changing column name for a read-only table
# Phil Hodge,  3-Apr-1995  Set TB_MODIFIED to true.
# Phil Hodge,  9-Apr-1995  Modify for FITS tables.
# Phil Hodge, 14-Apr-1998  Change calling sequence of tbcwcd.

procedure tbcnam (tp, cp, colname)

pointer tp			# i: pointer to table descriptor
pointer cp			# i: pointer to a column descriptor
char	colname[ARB]		# i: column name
#--
errchk	tbcwcd, tbfnam

begin
	call strcpy (colname, COL_NAME(cp), SZ_COLNAME)

	if (!TB_READONLY(tp)) {
	    # Save modified column descriptor in table file.
	    if (TB_TYPE(tp) == TBL_TYPE_FITS)
		call tbfnam (tp, cp, colname)
	    else
		call tbcwcd (tp, cp)
	    TB_MODIFIED(tp) = true
	}
end