NetBSD-Docs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

announcing, a deterministic man-page URL shortener

Dear NetBSD,

I would like to announce and introduce , a deterministic URL shortener for BSD manual pages, written entirely in nginx.conf.

It supports several address schemes, for example:

Source code for the whole is available at:

Specifically, the following currently (as of 2013-02-17) controls NetBSD rewriting, and best describes the access scheme for NetBSD:

        location /NetBSD {      rewrite ^/NetBSD(/.*)?$ /n$1;   }
        location /n {
                set     $nb     "";;
                rewrite ^/netbsd(/.*)?$ /.$1;
                rewrite ^/./([a-z]+[0-9]*[kx]?)/([^/]+)/([^/]+)$        $nb$3+$2.$1     redirect;
                rewrite ^/./([^/]+)/([^/]+)$            $nb$2+$1        redirect;
                rewrite ^/./([^/]+)\.([1-9]\.[a-z]+[0-9]*[kx]?)$        $nb$1+$2        redirect;
                rewrite ^/./([^/]+)\.([1-9])$           $nb$1+$2        redirect;
                rewrite ^/./([^/]+)$                    $nb$1   redirect;
                rewrite ^/./?$  /       last;
                return  404;

Basically, "/NetBSD" and "/netbsd" are rewritten to "/n" internally (with no extra reply to the user), and then the rest of the URI is analysed, and a "302 Found" redirect is finally issued to the user.

Pages like redirect to the main "/" page internally, without affecting the URL that's visible to the user, making it easier to keep as a starting page specifically for one BSD.

Comments and suggestions are very welcome. I've noticed there is an inconsistency between the available sections on these man-cgi scripts and the actual data that they can access: for example, only "X11R6" is listed on NetBSD's man-cgi, not "3X11", and, likewise, 3p is missing from OpenBSD's man.cgi, although works great. It would be nice if people more familiar with the organisation of manual pages would provide some insights on restricting or relaxing the current rewrites to be more conforming.

Also, is there a preferred method of referring to a certain page through a URL? What looks better: or ? Although the "/8/sysctl" style seems to be more popular with various static man-page collections and web-sites, and is potentially more flexible, especially for NetBSD, I nonetheless think that for the simple [1-9] sections the "/sysctl.8" style looks better and more familiar.

P.S. Mail-Followup-To:

Best regards,

Home | Main Index | Thread Index | Old Index