format_man_pages

来自「OTP是开放电信平台的简称」· 代码 · 共 129 行

TXT
129
字号
#!/bin/sh# #  Format man_pages#ERL_ROOT=$1echo "Formatting manual pages (this may take a while...)"if [ -z "$ERL_ROOT" -o ! -d "$ERL_ROOT" ]then	echo "Install: need ERL_ROOT directory as argument"	exit 1fiif [ `echo $ERL_ROOT | awk '{ print substr($1,1,1) }'` != "/" ]then	echo "Install: need an absolute path to ERL_ROOT"	exit 1fi## Fetch target system.#SYS=`(uname -s) 2>/dev/null` || SYS=unknownREL=`(uname -r) 2>/dev/null` || REL=unknowncase $SYS:$REL in	        SunOS:5.*)	                TARGET=sunos5 ;;	        Linux:*)	                TARGET=linux ;;                OpenBSD:3.*)                        TARGET=openbsd ;;	        *)	                TARGET="" ;;esac## Create the 'cat' directories (probably not needed)#cd $ERL_ROOTif [ ! -d man/cat1 ]then    mkdir man/cat1fiif [ ! -d man/cat3 ]then    mkdir man/cat3fiif [ ! -d man/cat4 ]then    mkdir man/cat4fiif [ ! -d man/cat6 ]then    mkdir man/cat6fi## Cleanup old formatting#cd $ERL_ROOT/manrm -f whatis windex# Remove old cat filesrm -f cat*/*.[0-9]* *.txt## Create new formatted pages#if [ "$TARGET" = "linux" ]then    # Do not build whatis database, since makewhatis can only run by root    # echo "whatis database not created, since makewhatis can only be run by root."    ## We would have run    ## /usr/sbin/makewhatis -v $ERL_ROOT/man -c $ERL_ROOT/man > /dev/null 2>&1    if [ ! -x /usr/bin/groff ]; then	echo "Cannot find groff - no formating of manual pages"	exit    fi    echo "Creating cat files ..."    # Create cat files    for dir in man*    do	cd $dir	for file in *.[0-9]*	do	    if [ -f $file ]; then		name=`echo $file | sed 's/\.[^.]*$//'`		sec=`echo $file | sed 's/.*\.//'`		/usr/bin/groff -Tascii -mandoc $ERL_ROOT/man/man$sec/$file \			> $ERL_ROOT/man/cat$sec/$file	    fi	done	cd ..    doneelse    if [ -f "/vmunix" ]; then 	CATMAN=/usr/etc/catman    elif [ "$TARGET" = "openbsd" ]; then        CATMAN=/usr/sbin/catman    else	CATMAN=/usr/bin/catman    fi    if [ "$TARGET" = "sunos5" ]    then	# Special processing of footer	rm -f /tmp/erltmac_an	sed 's/Last change://g' /usr/share/lib/tmac/an > /tmp/erltmac_an	$CATMAN -M $ERL_ROOT/man -T /tmp/erltmac_an > /dev/null 2>&1	rm -f /tmp/erltmac_an    fi    $CATMAN -M $ERL_ROOT/man > /dev/null 2>&1fi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?