From 35ac156d869f6e99131c2dff6e9e7c9f1123c5e4 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 15 Dec 2000 14:42:22 +0000 Subject: * 13281: Functions/Misc/mere: new implementation. Completion/User/_mere: new completion function for mere. --- ChangeLog | 5 +++ Completion/User/_mere | 3 ++ Functions/Misc/mere | 86 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 Completion/User/_mere diff --git a/ChangeLog b/ChangeLog index f27e791c3..68a79acf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-12-15 Tanaka Akira + + * 13281: Functions/Misc/mere: new implementation. + Completion/User/_mere: new completion function for mere. + 2000-12-13 Clint Adams * 13250: Completion/User/.distfiles, Completion/User/_dict: diff --git a/Completion/User/_mere b/Completion/User/_mere new file mode 100644 index 000000000..3dd27728b --- /dev/null +++ b/Completion/User/_mere @@ -0,0 +1,3 @@ +#compdef mere + +_files -g '*.[1-9]([a-z]|) *.man' diff --git a/Functions/Misc/mere b/Functions/Misc/mere index cf8d8ad14..496c67061 100644 --- a/Functions/Misc/mere +++ b/Functions/Misc/mere @@ -1,3 +1,83 @@ -#! /bin/sh -# read a man page in the current directory -nroff -man -Tman $1 | less -s +# read a man page + +setopt localoptions extendedglob + +local manual="$1" col=col terminal=man magic line + +# /usr/bin/col on SunOS 4 doesn't support -x. +if [[ -x /usr/5bin/col ]]; then + col=/usr/5bin/col; +fi + +# SunOS 5 has no `man' terminal. +if [[ -d /usr/share/lib/nterm && + ! -e /usr/share/lib/nterm/tab.$terminal ]]; then + terminal=lp; +fi + +# HP-UX has no `man' terminal. +if [[ -d /usr/share/lib/term && + ! -e /usr/share/lib/term/tab$terminal ]]; then + terminal=lp; +fi + +# Unixware has no `man' terminal. +if [[ -d /usr/ucblib/doctools/nterm && + ! -e /usr/ucblib/doctools/nterm/tab.$terminal ]]; then + terminal=lp; +fi + +# Solaris has SGML manuals. +if [[ -f /usr/lib/sgml/sgml2roff ]] && + [[ "$(read -er < $manual)" = "