aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/iki/fxf/fxfmkcard.x
blob: 81bb3ab76c0868d9831842f0c3501658780b6fd7 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
 
# FXF_MK_CARD --  Fetch a single line from a string parameter, padding it to
# a maximum of maxcols characters and trimmimg the delim character.

procedure fxf_make_card (instr, ip, card, col_out, maxcols, delim)

char	instr[ARB]	#I input string
int	ip		#U input string pointer, updated at each call
char	card[ARB]	#O FITS card image
int	col_out		#I pointer to column in card
int	maxcols		#I maximum columns in card
int	delim		#I 1 character string delimiter

int	op

begin
	op = col_out

	# Copy string
	while (op <= maxcols && instr[ip] != EOS && instr[ip] != delim) {
	    card[op] = instr[ip]
	    ip = ip + 1
	    op = op + 1
	}

	# Fill remainder of card with blanks
	while (op <= maxcols ) {
	    card[op] = ' '
	    op = op + 1
	}

	if (instr[ip] == delim)
	    ip = ip + 1
end