Fixing up man pages

Paul Schmehl pauls at utdallas.edu
Sun Jul 31 17:32:01 GMT 2005


--On July 31, 2005 4:11:04 PM +0200 Roman Neuhauser <neuhauser at sigpipe.cz> 
wrote:

># pauls at utdallas.edu / 2005-07-30 15:03:35 -0500:
>> --On July 30, 2005 11:26:05 AM +0200 Roman Neuhauser
>> <neuhauser at sigpipe.cz>  wrote:
>>
>> I posted a question about the sed script in questions, and once I
>> understood the guy's answer (which took a while), I got it working.
>>
>> Here's the working version:
>>
>> @${SED} -e '/man\.macros/r ${WRKSRC}/doc/man.macros' \
>>               -e '/man\.macros/d' ${WRKSRC}/doc/${f} > ${WRKDIR}/${f}
>>
>> What this does is parse man.macros for the string man\.macros and, if
>> found, use it as input to the second part that removes the string
>> man\.macros from the input stream and then feeds it to the file ${f},
>> which  is the manpage in the source.  Once the macro is in the manpage,
>> man can  display it properly.
>
>     That's incorrect. This is what it looks like again:
>
>     ${SED} -e '/man\.macros/r ${WRKSRC}/doc/man.macros'
>     -e '/man\.macros/d' ${WRKSRC}/doc/${f} > ${WRKDIR}/${f}
>
>     You need to remember that:
>
>     1. After any and all processing, sed prints each line of input
>        (stdin or an argument) to stdout unless told otherwise.
>        ("sed file" is just like "cat file" except dumb)
>
>     2. "sed -e 'cmd1' -e 'cmd2'" is the same as "sed -e "cmd1;cmd2".
>
>     3. The "r" command causes sed to "Copy the contents of file to
>        the standard output immediately before the next attempt to read a
>        line of input." (man page)
>
>     4. The "d" command causes sed to delete the currently processed line
>        and read the next one (but before that, sed passes through the
>        contents of man.macros as scheduled in step 3).
>
>     The above detailed behavior results in every line of input replaced
>     with the contents of ${WRKSRC}/doc/man.macros. This is done for every
>     file in ${TOPD_DIR}/doc whose name ends in ".n", and the result is
>     saved in $(MAN_INSTALL_DIR)/`basename iwidgets_$$i` I hope it's a
>     comprehensible explanation.
>
It is, and I thank you for that.  It makes a great deal of sense now.

Paul Schmehl (pauls at utdallas.edu)
Adjunct Information Security Officer
University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/


More information about the freebsd-ports mailing list