mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: Re: Request for volunteers
Date: Mon, 1 Jul 2013 14:12:49 -0700	[thread overview]
Message-ID: <20130701211249.GA4877@newbook> (raw)
In-Reply-To: <20130701174244.GB3727@newbook>

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

On Mon, Jul 01, 2013 at 10:42:45AM -0700, Isaac wrote:
> 
> I think it should be simple to convert the text to a man page once it's
> in plain text format, and plan to write a shell script to do that for 
> my own use shortly; I could provide the script to others, though I'm 
> not sure about distributing the output myself.

I have a shell script using mksh that does part of the work.
Currently, the useage would be like this:

for m in *.html
  do
   lynx -dump $m | posix2nroff $m > `basename $m .html`.3posix
  done
(I intend to change it to call lynx and add the extension, plus 
symlink where the HTML pages do so.)

IF YOU CHANGE THE SHELL, YOU WILL NEED TO DEBUG IT!
Quotes and escaping can vary subtly in ways that break the output (I know 
because I tested...); additionally, bash resulted in several places where
the output of printf was something like "N^HNA^HAM^HME^HE" (not sure why).


HTH,
Isaac Dunham

[-- Attachment #2: posix2nroff --]
[-- Type: text/plain, Size: 1255 bytes --]

#!/bin/mksh

#use read -r throughout; '\' cannot break this.
#discard <n>: advance position of read by n lines
discard(){
for i in `seq $1`
  do read -r header
  done
}

#use in pipes to delete leading whitespace
chompws(){
sed -e 's/^[[:space:]]*//'
}


mainparser(){
while read -r line; do
  case "$line" in
   ( NAME | SYNOPSIS | DESCRIPTION | RETURN*VALUE | ERRORS | EXAMPLES | APPLICATION*USAGE | RATIONALE | FUTURE*DIRECTIONS | CHANGE*HISTORY )
     printf ".SH $line\n.LP\n"
     ;;
   (SEE*ALSO)
     printf ".SH $line\n.LP\n"
     ;;
    ('['*']')
     echo '.TP 7'
     echo -n '.B '
     echo "$line" |tr -d [:punct:]
     ;;
    (*#include*)
     printf "$line\n" |sed -e 's/.*#include/#include/'
     ;;
    (----*)
     ;;
    (The*following*sections*informative*)
     echo -n '\\fI'
     echo -n "$line"
     echo '\\fP'
     ;;
    (End*informative*)
     break
     ;;
    (*)
     echo "$line"
     ;;
  esac
done
}
nameof(){
echo `basename $1 .html`
}

discard 4
for line in 1 2 3
  do read -r line
  echo -n '.\"'
  printf " $line\n"
  done

echo -n '.TH '`nameof $1 |tr [a-z] [A-Z]`' P 2013 "IEEE/The Open Group" "POSIX Programmers Manual"'

discard 2

mainparser
discard 11
echo '.SH COPYRIGHT'
echo '.LP'
read -r line
echo "$line"

  parent reply	other threads:[~2013-07-01 21:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-30  5:52 Rich Felker
2013-06-30 10:48 ` Szabolcs Nagy
2013-07-01  3:51   ` Rich Felker
2013-07-01 20:58     ` Szabolcs Nagy
2013-07-01 23:59       ` Rich Felker
2013-07-02  2:19         ` Szabolcs Nagy
2013-07-02  7:49           ` Rich Felker
2013-07-16 16:20             ` Szabolcs Nagy
2013-07-17 15:41               ` Rich Felker
2013-06-30 11:02 ` Daniel Cegiełka
2013-06-30 12:13   ` Rich Felker
2013-06-30 22:29     ` idunham
2013-07-01  3:31       ` Rich Felker
2013-07-01 17:42         ` Isaac
2013-07-01 17:46           ` Alex Caudill
2013-07-01 21:12           ` Isaac [this message]
2013-07-01  3:13     ` Rob Landley
2013-07-01  3:43       ` Rich Felker
2013-06-30 15:25 ` Nathan McSween
2013-06-30 22:59   ` Luca Barbato
2013-07-01 11:42 ` LM
2013-07-04 18:05 ` Rob Landley
2013-07-08  7:40   ` Szabolcs Nagy
2013-07-09  2:14     ` Rob Landley
2013-07-09  2:57       ` Matthew Fernandez
2013-07-08 14:45   ` Rich Felker
2013-07-09  2:54     ` Rich Felker
2013-07-08 14:12 ` Anthony G. Basile
2013-07-01 17:44 Felix Janda
2013-07-02  1:08 ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130701211249.GA4877@newbook \
    --to=idunham@lavabit.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).