config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit ff59acfc619d48d921cf5eb9a07d1d47446c15aa
parent 498abf0c727b0d70971032b312f0e667004b9b8b
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sat, 13 Feb 2021 16:41:13 -0800

Update sman script

It's now basically a sed(1) script and properly processes the new
documentation format.

Diffstat:
Mmodules/scripts/.local/bin/sman | 32+++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/modules/scripts/.local/bin/sman b/modules/scripts/.local/bin/sman @@ -1,20 +1,14 @@ -#!/usr/local/bin/rc -e -#! ssman -- simple script manual system -#! -#! sman prints text following `#![<space>]' verbatim, <space> includes -#! newline and EOF. If multiple scripts are given each is seperated by -#! a blank line, three dashes, then another blank line. -#! -#! Only hashes (`#') are supported so the scripting language must use -#! them as comments or have multiline comments. +#!/bin/sh +# Copywrite 2021 Jacob R. Edwards +# License: GPLv3 +# +# sman -- simple script manual system +# +# Write lines beginning in `#' excluding `# ?', ignoring lines +# beginning in `#!', until a line which does not begin with `#' +# appears. -# To increase performance perhaps using awk would be better since, -# after a manual block is printed, we can stop processing. -fn sman { egrep '^#!([[:space:]]|$)' $* | cut -c 4- } - -for (i in `{ jot $#* }) { - sman `{ which $*($i) } - if (test $i -gt 0 -a $i -lt $#*) - printf '\n---\n\n'; - man = 1; -} +for i in $* +do + sed -Ene '/^#!/d' -e '/^#/!q' -e 's/^# ?//p' `which $i` +done