#!/bin/sh rcsid='$MirOS: src/bin/mksh/FAQ2HTML.sh,v 1.2 2020/10/31 04:17:36 tg Exp $' #- # Copyright © 2020 # mirabilos # # Provided that these terms and disclaimer and all copyright notices # are retained or reproduced in an accompanying document, permission # is granted to deal in this work without restriction, including un‐ # limited rights to use, publicly perform, distribute, sell, modify, # merge, give away, or sublicence. # # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to # the utmost extent permitted by applicable law, neither express nor # implied; without malicious intent or gross negligence. In no event # may a licensor, author or contributor be held liable for indirect, # direct, other damage, loss, or other issues arising in any way out # of dealing in the work, even if advised of the possibility of such # damage or existence of a defect, except proven that it results out # of said person’s immediate fault when using the work as intended. #- set -e LC_ALL=C; LANGUAGE=C export LC_ALL; unset LANGUAGE nl=' ' srcdir=$(dirname "$0") p=--posix sed $p -e q /dev/null 2>&1 || p= v=$1 if test -z "$v"; then v=$(sed $p -n '/^#define MKSH_VERSION "\(.*\)"$/s//\1/p' "$srcdir"/sh.h) fi src_id=$(sed $p -n '/^RCSID: /s///p' "$srcdir"/mksh.faq) # sanity check case $src_id in *"$nl"*) echo >&2 "E: more than one RCSID in mksh.faq?" exit 1 ;; esac sed $p \ -e '/^RCSID: \$/s/^.*$/----/' \ -e 's!@@RELPATH@@!http://www.mirbsd.org/!g' \ -e 's^  ' \ "$srcdir"/mksh.faq | tr '\n' '' | sed $p \ -e 'sg' \ -e 's----g' \ -e 's\([^]*\)\1g' \ -e 's\([^]*\)\1g' \ -e 's\([^]*\)*ToC: \([^]*\)Title: \([^]*\)\([^]*\)\{0,1\}

\3


g' \ -e 's[^]*

g' \ -e 's^
*' \ -e 's$' \ -e 's<><>g' \ -e 'sg' | tr '' '\n' >FAQ.tmp exec >FAQ.htm~ cat < mksh $v FAQ (local copy)

Note: Links marked like this one to the mksh IRC channel connect to external resources.

Notice: the website will have the latest version of the mksh FAQ online.

Table of Contents

    EOF sed $p -n \ '/^

    ]*\(>.*<\/a><\/\)h2>$/s//