File: mtencode.x

package info (click to toggle)
iraf 2.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,000 kB
  • sloc: ansic: 115,890; fortran: 74,576; lisp: 18,888; yacc: 5,642; sh: 961; lex: 596; makefile: 509; asm: 159; csh: 54; xml: 33; sed: 4
file content (44 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download | duplicates (7)
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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# MTENCODE -- Construct a full magtape device specification.  This routine is
# the opposite of MTPARSE.  If the file and record numbers are to be omitted
# from the output mtname they should be passed as ERR.

procedure mtencode (outstr, maxch, device, fileno, recno, attrl)

char	outstr[ARB]			#O magtape device specification
int	maxch				#I max chars out
char	device[ARB]			#I device name (incl node)
int	fileno, recno			#I file and record numbers, or ERR
char	attrl[ARB]			#I tapecap attributes

int	op
int	gstrcpy()
int	itoc()

begin
	if (fileno != ERR || recno != ERR || attrl[1] != EOS) {
	    op = gstrcpy (device, outstr, maxch) + 1
	    outstr[op] = '[';  op = op + 1 
	    if (fileno != ERR) {
		if (fileno == EOT)
		    op = op + gstrcpy ("EOT", outstr[op], maxch-op+1)
		else
		    op = op + itoc (fileno, outstr[op], maxch-op+1)
	    }
	    if (recno != ERR) {
		outstr[op] = '.';  op = op + 1
		op = op + itoc (recno, outstr[op], maxch-op+1)
	    }
	    if (attrl[1] != EOS) {
		if (attrl[1] != ':') {
		    outstr[op] = ':'
		    op = op + 1
		}
		op = op + gstrcpy (attrl, outstr[op], maxch-op+1)
	    }
	    outstr[op] = ']';  op = op + 1
	    outstr[op] = EOS
	} else
	    call strcpy (device, outstr, maxch)
end