-
Notifications
You must be signed in to change notification settings - Fork 2
/
mk_sect.SX
50 lines (50 loc) · 884 Bytes
/
mk_sect.SX
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
# mk_sect.sx - Make a section for the SamaruX printed manual
#
# Last edited: 19 Sep 2021
#
# Use: batch mk_sect.sx dest_file section_number section_title man_topic
# Ex.: batch mk_sect.sx sec202.txt '2.03' 'File and directory names' files
# Ex.: batch mk_sect.sx sec130.txt '3.05' '' cat
#
if $# eq 4 goto make
echo Error in # of args.
goto end
#
# make:
#
if $3 eq '' goto make2
env SECTITLE $3
goto make3
#
# make2:
#
env SECTITLE $4
#
# make3:
#
echo Making SECTION $2 : $SECTITLE
#
echo -n ' ' $2 ': ' >> toc.tmp
if $3 eq '' goto cmd
echo $3 >> toc.tmp
goto dump
#
# cmd:
#
env SRCH $4 '- '
man $4 | grep $SRCH | read RAWTITLE
batch trim $RAWTITLE '>> toc.tmp'
env SRCH
env RAWTITLE
#
# dump:
#
cat sectsep.tmp > $1
echo '+--------------+' >> $1
echo '| SECTION' $2 '| ' $SECTITLE >> $1
echo '+--------------+' >> $1
cat nl.tmp >> $1
man $4 >> $1
env SECTITLE
#
# end: