aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbfgcm.x
blob: 22e483ad4b02a1d5ca8728789caad6c9b493bb94 (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
42
43
44
45
46
47
48
49
50
include <tbset.h>
include "tbtables.h"

# tbfgcm -- get a comment for a FITS header parameter
#
# Phil Hodge,  6-Jul-1995  Subroutine created

procedure tbfgcm (tp, keyword, comment, maxch)

pointer tp			# i: pointer to table descriptor
char	keyword[SZ_KEYWORD]	# i: keyword to be found
char	comment[ARB]		# o: comment string for keyword
int	maxch			# i: max size of comment
#--
pointer sp
pointer value			# scratch for value (ignored)
pointer cmt			# scratch for comment; also for error message
int	status			# zero is OK
bool	streq()
errchk	tbferr

begin
	call smark (sp)
	call salloc (value, SZ_LINE, TY_CHAR)
	call salloc (cmt, SZ_LINE, TY_CHAR)

	# Check for history or comment.
	call strcpy (keyword, Memc[value], SZ_LINE)	# temp
	call strupr (Memc[value])
	if (streq (Memc[value], "HISTORY") ||
	    streq (Memc[value], "COMMENT") ||
	    streq (Memc[value], "       ") || keyword[1] == EOS) {

	    comment[1] = EOS
	    call sfree (sp)
	    return
	}

	status = 0

	# Get the value and comment.
	call fsgkey (TB_FILE(tp), keyword, Memc[value], Memc[cmt], status)

	if (status != 0)
	    call tbferr (status)

	call strcpy (Memc[cmt], comment, maxch)

	call sfree (sp)
end