]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/MKterminfo.sh
ncurses 4.1
[ncurses.git] / man / MKterminfo.sh
1 #!/bin/sh
2 #
3 # MKterminfo.sh -- generate terminfo.5 from Caps tabular data
4 #
5 # This script takes terminfo.head and terminfo.tail and splices in between
6 # them a table derived from the Caps master file.  Besides avoiding having
7 # the docs fall out of sync with the table, this also lets us set up tbl
8 # commands for better formatting of the table.
9 #
10 # NOTE: The \ 5s in this script really are control characters.  It translates
11\ 5 to \n because I couldn't get used to inserting linefeeds directly.  There
12 # had better be no \ 5s in the table source text.
13 #
14 head=$1
15 caps=$2
16 tail=$3
17 cat <<'EOF'
18 '\" t
19 .\" DO NOT EDIT THIS FILE BY HAND!
20 .\" It is generated from terminfo.head, Caps, and terminfo.tail.
21 .\"
22 .\" Note: this must be run through tbl before nroff.
23 .\" The magic cookie on the first line triggers this under some man programs.
24 EOF
25 cat $head
26 sed -n <$caps "\
27 /%%-STOP-HERE-%%/q
28 /^#%/s///p
29 /^#/d
30 s/$/\ 5T}/
31 s/      [Y\-][B\-][C\-][G\-][E\-]\**    /       T{\ 5/
32 s/      bool    /       /p
33 s/      num     /       /p
34 s/      str     /       /p
35 " | tr "\ 5" "\012"
36 cat $tail