diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 13:37:49 +0100 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 13:37:49 +0100 |
| commit | c5a1e08b52b2f6c05e0116d46277904b711b6bdb (patch) | |
| tree | a6ad7350d1b1100356ca59616d22c51dd29743eb /man/MKterminfo.sh | |
| parent | 24fa7a5107c5b75d1c197accf0305be64bc72882 (diff) | |
Vendor import ncurses 6.6vendor/ncurses/6.6vendor/ncurses
Diffstat (limited to 'man/MKterminfo.sh')
| -rwxr-xr-x | man/MKterminfo.sh | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/man/MKterminfo.sh b/man/MKterminfo.sh index 882ef2ad093b..d5cdbc852429 100755 --- a/man/MKterminfo.sh +++ b/man/MKterminfo.sh @@ -1,10 +1,10 @@ #!/bin/sh -# $Id: MKterminfo.sh,v 1.20 2024/01/13 20:37:40 tom Exp $ +# $Id: MKterminfo.sh,v 1.28 2025/11/12 01:07:10 Branden.Robinson Exp $ # # MKterminfo.sh -- generate terminfo.5 from Caps tabular data # #*************************************************************************** -# Copyright 2018-2020,2022 Thomas E. Dickey * +# Copyright 2018-2024,2025 Thomas E. Dickey * # Copyright 1998-2003,2017 Free Software Foundation, Inc. * # * # Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,33 +49,50 @@ if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi -# +# collect the command-line parameters of the script head="$1" -shift 1 +shift caps= +capstext= while test $# -gt 1 do caps="$caps $1" - shift 1 + capstext="$capstext, $1" + shift done tail="$1" + +MYTEMP=`mktemp -d 2>/dev/null` +if [ -z "$MYTEMP" ] +then + MYTEMP=${TMPDIR:-/tmp}/ncurses$$ +fi +mkdir -p "$MYTEMP" || failed "cannot mkdir $MYTEMP" +trap "rm -rf $MYTEMP; exit 1" HUP INT QUIT TERM +trap "rm -rf $MYTEMP" EXIT + +temp=$MYTEMP/temp +pass1=$MYTEMP/pass1 +pass2=$MYTEMP/pass2 +pass3=$MYTEMP/pass3 +sorted=$MYTEMP/sorted +unsorted=$MYTEMP/unsorted + cat <<EOF '\\" t .\\" DO NOT EDIT THIS FILE BY HAND! -.\\" It is generated from terminfo.head, $caps, and terminfo.tail. +.\\" man/MKterminfo.sh generated it from: +.\\" terminfo.head$capstext, +.\\" and terminfo.tail. .\\" -.\\" Note: this must be run through tbl before nroff. -.\\" The magic cookie on the first line triggers this under some man programs. +.\\" Note: this document must be run through tbl before nroff or troff. +.\\" Some man(1) programs recognize the token in the first-line comment +.\\" as directing them to arrange such a pipeline. EOF -cat "$head" -temp=temp$$ -sorted=sorted$$ -unsorted=unsorted$$ -trap 'code=$?; rm -f $sorted $temp $unsorted; exit $code' EXIT HUP INT QUIT TERM -rm -f $sorted $temp $unsorted +cat "$head" -cat $caps | sed -n "\ +cat >$pass1 <<EOF /%%-STOP-HERE-%%/q /^#%center/s, expand,, /^#%lw25/s, lw6 , lw7 , @@ -84,12 +101,16 @@ cat $caps | sed -n "\ s/[ ][ ]*/ /g s/$/T}/ s/ [A-Z0-9_()\-][A-Z0-9_()\-]* [0-9\-][0-9\-]* [Y\-][B\-][C\-][G\-][EK\-]\** / T{\\ -.ad l\ +.na\ / s/ bool / /p s/ num / /p s/ str / /p -" |sed -e 's/^$/../' | tr "\134" "\006" >$unsorted +EOF + +echo 's/^$/../' > $pass2 + +sed -n -f $pass1 $caps | sed -f $pass2 | tr "\134" "\006" >$unsorted rm -f $sorted rm -f $temp @@ -116,8 +137,11 @@ do done <$unsorted test $saved = yes && sort $temp >>$sorted -sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" +sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" | sed -e '/^$/d' + +cat > $pass3 << "EOF" +/^center expand;/s, expand,, +/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l., +EOF -sed -e '/^center expand;/s, expand,,' \ - -e '/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l.,' \ - "$tail" +sed -f $pass3 "$tail" |
