|
|
1.1 root 1: subroutine helper(h)
2: character*4 h(4)
3: c
4: c Handle HELP file
5: c h = key word, format 4a1
6: c
7: c Two direct access files are required. Their locations are:
8: c
9: character*(*) idfile,dafile
10: parameter(idfile='/v/lib/mathelp.idx')
11: parameter(dafile='/v/lib/mathelp.dac')
12: c
13: parameter(lrecl=66)
14: character*66 line
15: character*4 keys(128),key
16: integer locs(128)
17: INTEGER DDT,ERR,FMT,LCT(4),LIN(1024),LPT(6),RIO,WIO,RTE,WTE,HIO
18: COMMON /IOP/ DDT,ERR,FMT,LCT,LIN,LPT,RIO,WIO,RTE,WTE,HIO
19: c
20: c Initialization indicated by h(1) = 0
21: c
22: if (h(1)(1:1) .eq. char(0)) then
23: open(unit=HIO,file=idfile,access='DIRECT',recl=8)
24: n = 0
25: 10 n = n + 1
26: read(HIO,rec=n,err=15) keys(n),locs(n)
27: if (keys(n) .ne. 'EOF ') go to 10
28: 15 close(unit=HIO)
29: nkeys = n-1
30: key = 'HELP'
31: open(unit=HIO,file=dafile,access='DIRECT',recl=lrecl)
32: endif
33: c
34: c Convert h to conventional string
35: c
36: if (h(1)(1:1) .ne. char(0)) then
37: do 20 i = 1, 4
38: key(i:i) = h(i)
39: 20 continue
40: endif
41: c
42: c Special case, HELP followed by blank. Give general help.
43: c
44: if (key .eq. ' ') then
45: write(WTE,30)
46: if (WIO .ne. 0) write(WIO,30)
47: 30 format(0X,'Type HELP followed by'
48: > /0X,'INTRO (To get started)'
49: > /0X,'NEWS (recent revisions)')
50: write(WTE,31) (keys(n), n = 19, nkeys)
51: if (WIO .ne. 0) write(WIO,31) (keys(n), n = 19, nkeys)
52: 31 format(0X,a4,10a6)
53: write(WTE,32) (keys(n), n = 4, 18)
54: if (WIO .ne. 0) write(WIO,32) (keys(n), n = 4, 18)
55: 32 format(0X,15(a1,1x))
56: return
57: endif
58: c
59: c Find key word in keys table
60: c
61: do 40 k = 1, nkeys
62: if (key .eq. keys(k)) go to 50
63: 40 continue
64: write(WTE,45) key
65: if (WIO .ne. 0) write(WIO,45) key
66: 45 format(0X,'SORRY, NO HELP ON ',a4)
67: return
68: c
69: c Read and echo lines from direct access help file
70: c
71: 50 write(WTE,75)
72: if (WIO .ne. 0) write(WIO,75)
73: k0 = locs(k)
74: k1 = locs(k+1) - 2
75: do 80 k = k0, k1
76: 60 read(HIO,rec=k) line
77: do 65 j = lrecl, 1, -1
78: if (line(j:j) .ne. ' ') go to 70
79: 65 continue
80: 70 write(WTE,75) line(1:j)
81: if (WIO .ne. 0) write(WIO,75) line(1:j)
82: 75 format(0X,a)
83: 80 continue
84: return
85: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.