Viewing man pages in the browser

Ask a Question related to Mac Applications & Software, Design and Development.

  1. #1

    Default Viewing man pages in the browser

    Macosxhints.com in a July 7 hint describes a nifty app called manServer
    which displays UNIX man pages in a "web site", complete with
    hyperlinks.

    The program is described at
    [url]http://www.squarebox.co.uk/download/manServer.shtml[/url]

    and can be downloaded at
    [url]http://www.squarebox.co.uk/download/manServer_107.pl[/url] .

    It works really great as described, but if you have experience with it,
    I have two questions:

    1. Can it be tweaked so typing "man ls" in Terminal would open the
    html'd man page in Safari? (I can just kiss good bye to nroff.)

    2. Can I add an item to mac help menu which will open the manServer
    startup page in Safari?

    -
    Kiran Guest

  2. Similar Questions and Discussions

    1. Viewing cfm files in a browser
      I'm running an apache 2 server on windows XP with coldfusion mx 7 installed to use the apache server and not the test server that comes with...
    2. Viewing in Remote Browser
      When I attempt to view my ASP.NET page in a browser, I receive instead a File Download screen. I am connected to a remote server via FTP and I have...
    3. Acrobat 7 - disable browser PDF viewing!!
      I prefer that when I am using Safari if I click on a link to a PDF that it simply automatically download the whole PDF to the downloads folder I...
    4. IE Browser crashes when viewing PDF
      HI, (also left this in the Reader forum, but thought perhaps it fit this better after all.) I work in the Corporate Communications group for CSC...
    5. CS Browser - colors darken while viewing in browser
      I recently installed Photoshop CS. I set up color management. When I browse a set of images taken with my Sony F717 they appear in the browser (with...
  3. #2

    Default Re: Viewing man pages in the browser

    In article <090720030131101808%kiran@no.spam>, Kiran wrote:
    > The program is described at
    > [url]http://www.squarebox.co.uk/download/manServer.shtml[/url]
    Cute.

    > 1. Can it be tweaked so typing "man ls" in Terminal would open the
    > html'd man page in Safari? (I can just kiss good bye to nroff.)
    One quick-and-dirty way in tcsh:

    alias man 'open http://:8888/\!^'

    assuming you're using the default manServer port on localhost and
    Safari is your default browser. Of course this only works for the
    simplest man commands: no options, no section spec.

    tristero Guest

  4. #3

    Default Re: Viewing man pages in the browser

    Kiran wrote:
    > > The program is described at
    > > [url]http://www.squarebox.co.uk/download/manServer.shtml[/url]
    > > 1. Can it be tweaked so typing "man ls" in Terminal would open the
    > > html'd man page in Safari? (I can just kiss good bye to nroff.)
    tristero
    > One quick-and-dirty way in tcsh:
    >
    > alias man 'open http://:8888/\!^'
    Since I'd rather not have manServer run perpetually as a web server, I
    wrote the little script below. I put it in ~/bin and called it wman to
    keep it different from the norman man.

    -Eric

    #!/bin/csh

    ################################################## ###########
    # Run manServer.pl on OS X to produce temporary html source
    # open html in default web browser
    # delete temporary html
    #
    # manServer.pl is written by
    # Rolf Howarth (rolf@squarebox.co.uk)
    # and is available from
    # [url]http://www.squarebox.co.uk/download/manServer.shtml[/url]
    #
    # E Salathe 08JUL2003
    ################################################## ###########



    # set these to appropriate locations on your system

    # location of the manServer.pl script
    set manserv = ~/bin/manServer.pl

    # location for temporary html source
    set tmp_html = ~/tmp/manpage.html

    # if no args, print usage and exit

    if($#argv != 1) then
    echo "usage: wman <command>"
    exit
    endif

    # run manserver to produce html and open in default browser

    ($manserv $1 > $tmp_html) >& /dev/null
    open $tmp_html

    # wait a few secs to be sure file opens then delete it
    (sleep 10; rm -f $tmp_html) &

    exit
    Eric Salathe Guest

  5. #4

    Default Re: Viewing man pages in the browser

    In article <090720031308373616%kiran@no.spam>, Kiran wrote:
    > % alias man 'open http://:8888/\!^'
    > % man
    > Bad ! arg selector.
    Right, this extremely simple alias hack assumes you give exactly one
    argument to man: not 0, not more than one.

    You can write a short shell script to be more general, I was trying to
    give the easiest possible way to do what you asked. A quick script
    would look like this:

    #!/bin/sh
    exec open http://:8888/$*


    Then alias man to run that script.


    > % man ls
    > chmod: [url]http://:8888/ls:[/url] No such file or directory
    ?

    What happens if you type "open http://:8888/ls" directly to the csh
    prompt when the manServer is running?

    >
    > Also,
    > % /Library/WebServer/CGI-Executables/manServer
    I'm using 'manServer -s', not the cgi thing. Not only is this
    simpler, it also lets you run the manServer without having to run
    full web server.


    tristero Guest

  6. #5

    Default Re: Viewing man pages in the browser

    Wesley Groleau wrote:

    <snip>
    > open /Users/sysadmin/tmp/manpage.html
    > kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks.
    > kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
    > kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
    > kCGErrorInvalidConnection : CGSGetEventPort: Invalid connection
    > sleep 10
    > [1] 900
    > exit
    > [localhost:~] sysadmin% rm -f /Users/sysadmin/tmp/manpage.html
    >
    > [localhost:~] sysadmin%
    >
    > So, can anyone tell me what is wrong in my 10.1.5 system?
    It is failing on the open command; this is a Quartz error message.
    Does this work otherwise? Try this:

    % cat > test.html << $
    <h1>TEST</h1>
    $
    % open test.html

    Here's what I can think of: Are you logged into your mac as sysadmin,
    or did you su to sysadmin from the shell? I think you need to execute
    open as the same user account who owns the display.

    -Eric
    Eric Salathe Guest

  7. #6

    Default Re: Viewing man pages in the browser

    Kiran <kiran@no.spam> wrote
    > I started personal web-sharing according to instructions and didn't
    > specify any port anywhere, so I assume everything is default.
    > However, here is what I get:
    > % man ls
    > chmod: [url]http://:8888/ls:[/url] No such file or directory
    The alias tristero posted assumes you are running manServer's own web
    server (manServer -s), which is on port 8888. Apache (aka "personal
    web sharing") is not at 8888, so this URL does not point to anything.
    Also, Apache does not know about manServer unless you set it up thru
    cgi.

    Your best bet is to either use the manServer -s option on port 8888 or
    eliminate the web server altoghether as in my script.

    -Eric
    Eric Salathe Guest

  8. #7

    Default Re: Viewing man pages in the browser

    By the way, my script has problems if your .cshrc does a recursive
    addition to MANPATH, such as in fink's init.csh:

    setenv MANPATH /sw/share/man:/sw/man:${MANPATH}:/usr/X11R6/man

    manServer seems to get confused when directories are listed multiple
    times in MANPATH.

    fink users need to move the line "source /sw/bin/init.csh" out of
    ..cshrc and into .login, where it is better off. Likewise, any other
    custimizations to MANPATH should be in .login.

    -Eric
    Eric Salathe Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139