From owner-freebsd-ports Mon May 21 16: 4:24 2001 Delivered-To: freebsd-ports@freebsd.org Received: from mail.noos.fr (zola.noos.net [212.198.2.76]) by hub.freebsd.org (Postfix) with ESMTP id DBBAA37B422 for ; Mon, 21 May 2001 16:04:16 -0700 (PDT) (envelope-from clefevre@poboxes.com) Received: (qmail 32777458 invoked by uid 0); 21 May 2001 23:04:15 -0000 Received: from d165.dhcp212-198-231.noos.fr (HELO gits.dyndns.org) ([212.198.231.165]) (envelope-sender ) by zola.noos.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 21 May 2001 23:04:15 -0000 Received: (from root@localhost) by gits.dyndns.org (8.11.3/8.11.3) id f4LN4E357028; Tue, 22 May 2001 01:04:14 +0200 (CEST) (envelope-from clefevre@poboxes.com) To: ports@FreeBSD.org Subject: Re: PR Review References: <200105210118.f4L1IZD10845@gits.dyndns.org> <0ae001c0e194$56f54d60$931576d8@inethouston.net> <4rues3ua.fsf@gits.dyndns.org> X-Face: V|+c;4!|B?E%BE^{E6);aI.[<97Zd*>^#%Y5Cxv;%Y[PT-LW3;A:fRrJ8+^k"e7@+30g0YD0*^^3jgyShN7o?a]C la*Zv'5NA,=963bM%J^o]C Reply-To: Cyrille Lefevre In-Reply-To: <4rues3ua.fsf@gits.dyndns.org> From: Cyrille Lefevre Date: 22 May 2001 01:04:13 +0200 Message-ID: Lines: 200 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org was Cc: "David W. Chapman Jr." , "Will Andrews" Cyrille Lefevre writes: > "David W. Chapman Jr." writes: > > > Cool, I wasn't as proficient in awk sed and perl so I had to initially do > > the conversion in foxpro on windows. I think maybe we should try to get > > that script on the porters handbook for the man pages, what do you think? > > how about this one I've just written :P > all is made in one pass w/ temporary files... > > so, the Makefile.man I've sent to your PR can be obtained using the > following commmand (except MANCOMPRESSED) : > > mkmakeman -q -o Makefile.man -p /usr/X11R6 /usr/ports/x11/XFree86-4/pkg-plist > > another sample using this command maybe, for fresh ports : > > mkmakeman -q -a Makefile /tmp/local > > which appends MAN? variables to the current Makefile. > > you're free to write a manual page it you want. since english isn't my > native language, well, humm! I didn't know how to say what I want to > say in english ;^) > > PS : if the license is a problem, let me know, I'll change it. > > #!/bin/sh -e > # > # @(#) mkmakeman 1.0 (clefevre@poboxes.com) Tue May 22 00:49:18 CEST 2001 > # > # Copyright (c) 2001 Cyrille Lefevre. All rights reserved. > # > # Redistribution and use in source and binary forms, with or without > # modification, are permitted provided that the following conditions > # are met: > # > # 1. Redistributions of source code must retain the above copyright > # notice, this list of conditions and the following disclaimer. > # 2. Redistributions in binary form must reproduce the above copyright > # notice, this list of conditions and the following disclaimer in > # the documentation and/or other materials provided with the > # distribution. > # 3. The name of the authors and contributors may not be used to > # endorse or promote products derived from this software without > # specific prior written permission. > # > # THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' > # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS > # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, > # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT > # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > # SUCH DAMAGE. > > append= > quiet= > mandir=man/man > prefix= > ofile=/dev/null > sections="1 2 3 4 5 6 7 8 9 l n" > ifile= > > cat=cat make=make grep=grep find=find sort=sort > xargs=xargs ls=ls sed=sed awk=awk tee=tee > > usage () { > # bip! game over, same player, play again ;^) > $cat << EOF >&2 > usage: $0 [-q] [-m mandir] [-a|-o file] [-s sections] dir > $0 [-q] [-m mandir] [-p prefix] [-a|-o file] [-s sections] file > EOF > exit 64 > } > > abspath () { > # make the path absolute > case $1 in > /*) > echo $1 ;; > *) > echo $(pwd)/$1 ;; > esac > } > > while getopts a:m:o:p:qs: c; do > case $c in > a) > append=-a > ofile=$(abspath $OPTARG) ;; > m) > mandir=$OPTARG ;; > o) > ofile=$(abspath $OPTARG) ;; > p) > prefix=$OPTARG ;; > q) > quiet="> /dev/null" ;; > s) > sections=$OPTARG ;; > *) > usage ;; > esac > done > shift $(($OPTIND - 1)) > > # no args, good bye > if [ $# -eq 0 ]; then > usage > # a directory ? > elif [ -d "$1" ]; then > prefix=$1 > # a plain file then > else > if [ -z "$prefix" ]; then > # no prefix, try the find one > if [ -f Makefile ]; then > prefix=$($make -V PREFIX) > else > usage > fi > fi > ifile=$(abspath $1) > fi > > cd "$prefix" || exit > > for sec in $sections; do > if [ -n "$ifile" ]; then > $grep "$mandir$sec" "$ifile" > else > # find all manual pages > $find "$mandir$sec" ! -type d > fi | > # sort them > $sort +8 | > # expand symlinks > $xargs $ls -ld | > # mandir and suffix aren't needed > $sed "s,$mandir$sec/,$sec ,;s/\.gz//g" > # ^^^^^ we use that later > done | > $awk -v sections="$sections" ' > BEGIN { > # this ugly thing works ! > nsections = split (sections, sections, " ") > } > # found a symlink > /->/ { > links [nlinks++] = $NF " " $(NF - 2) > next > } > # so, its a plain file > { > # get the section number > sec = $(NF - 1) > # fill in an array by sections > mans [sec,nmans [sec]++] = $NF > } > END { > # for each sorted sections > for (k = 1; k <= nsections; k++) { > # get its name > sec = sections [k] > # is there any manual ? > if (! nmans [sec]) > continue > # ok, go on... > printf "MAN%s=", toupper(sec) > # let us go a lot faster > j = nmans [sec] - 1 > # for each manual > for (i = 0; i < nmans [sec]; i++) > # dont put a \ on the last line > printf "\t%s%s\n", mans [sec,i], i == j ? "" : " \\" > } > if (nlinks) { > printf "MLINKS=" > j = nlinks - 1 > for (i = 0; i < nlinks; i++) > printf "\t%s%s\n", links [i], i == j ? "" : " \\" > } > } > ' | > eval $tee $append "$ofile" $quiet Cyrille. -- Cyrille Lefevre - 12, Rue de Bizerte 75017 Paris tel/fax: +33 (0)1 45 22 83 85 home: mailto:clefevre@poboxes.com UNIX is user-friendly; it's just particular work: mailto:Cyrille.Lefevre@edf.fr about who it chooses to be friends with. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message