#!/bin/sh # # Run paragraphs of help text thru fmt(1) # Lines with tabs or double spaces are run thru fmt(1) only for that line # source the PCP configuration environment variables . $PCP_DIR/etc/pcp.env tmp=`mktemp -d /tmp/pcp.XXXXXXXXX` || exit 1 trap "rm -rf $tmp; exit" 0 1 2 3 15 $PCP_AWK_PROG -v tmpfile=$tmp/fmt ' function fmt_line(l) { print l > tmpfile system("fmt -78 < " tmpfile) # format line(s) close(tmpfile) system(">" tmpfile) # truncate file } function format_line() { if (line != "") { fmt_line(line) line = "" } } BEGIN { line = "" } /^#/ || /^@/ { format_line(); print; next } / / || / / { format_line(); fmt_line($0); next } /^$/ { format_line(); print; next } { if (line == "") line = $0 else line = sprintf("%s\n%s",line,$0) } END { format_line() } '