[BACK]Return to catman.8 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/catman.8, Revision 1.10

1.10    ! schwarze    1: .\"    $Id: catman.8,v 1.9 2025/06/29 23:00:58 schwarze Exp $
1.1       kristaps    2: .\"
1.7       schwarze    3: .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
1.1       kristaps    4: .\"
                      5: .\" Permission to use, copy, modify, and distribute this software for any
                      6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
                      8: .\"
                      9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     16: .\"
1.10    ! schwarze   17: .Dd $Mdocdate: June 29 2025 $
1.1       kristaps   18: .Dt CATMAN 8
                     19: .Os
                     20: .Sh NAME
                     21: .Nm catman
1.7       schwarze   22: .Nd format all manual pages below a directory
1.1       kristaps   23: .Sh SYNOPSIS
                     24: .Nm catman
1.7       schwarze   25: .Op Fl I Cm os Ns = Ns Ar name
                     26: .Op Fl T Ar output
                     27: .Ar srcdir dstdir
1.1       kristaps   28: .Sh DESCRIPTION
                     29: The
                     30: .Nm
1.7       schwarze   31: utility assumes that all files below
                     32: .Ar srcdir
                     33: are manual pages in
                     34: .Xr mdoc 7
                     35: and
                     36: .Xr man 7
                     37: format and formats all of them, storing the formatted versions in
                     38: the same relative paths below
                     39: .Ar dstdir .
                     40: Subdirectories of
                     41: .Ar dstdir
                     42: are created as needed.
                     43: Existing files are not explicitly deleted, but possibly overwritten.
1.5       kristaps   44: .Pp
1.7       schwarze   45: The options are as follows:
                     46: .Bl -tag -width Ds
                     47: .It Fl I Cm os Ns = Ns Ar name
                     48: Override the default operating system
                     49: .Ar name
                     50: for the
                     51: .Xr mdoc 7
1.8       schwarze   52: .Ic \&Os
1.7       schwarze   53: and for the
                     54: .Xr man 7
                     55: .Ic TH
                     56: macro.
                     57: .It Fl T Ar output
                     58: Output format.
                     59: The
                     60: .Ar output
                     61: argument can be
                     62: .Cm ascii ,
                     63: .Cm utf8 ,
                     64: or
                     65: .Cm html ;
                     66: see
                     67: .Xr mandoc 1 .
                     68: In
                     69: .Cm html
                     70: output mode, the
                     71: .Cm fragment
                     72: output option is implied.
                     73: Other output options are not supported.
                     74: .El
                     75: .Sh IMPLEMENTATION NOTES
                     76: Since this version avoids
                     77: .Xr fork 2
                     78: and
                     79: .Xr exec 3
                     80: overhead and uses the much faster
                     81: .Sy mandoc
                     82: parsers and formatters rather than
                     83: .Sy groff ,
                     84: it may be about one order of magnitude faster than other
1.5       kristaps   85: .Nm
1.7       schwarze   86: implementations.
                     87: .Sh EXIT STATUS
                     88: .Ex -std
1.5       kristaps   89: .Pp
1.9       schwarze   90: Failures while trying to open individual manual pages for reading,
                     91: to save individual formatted files to the file system,
                     92: or even to read or create subdirectories do not cause
                     93: .Nm
                     94: to return an error exit status.
                     95: In such cases,
                     96: .Nm
                     97: simply continues with the next file or subdirectory.
                     98: .Sh DIAGNOSTICS
                     99: Some fatal errors cause
                    100: .Nm
                    101: to exit before the iteration over input files is even started:
                    102: .Bl -tag -width Ds -offset indent
                    103: .It unknown option \-\- Ar option
                    104: An invalid option was passed on the command line.
1.10    ! schwarze  105: .It missing arguments: srcdir and dstdir
        !           106: No argument was provided.
        !           107: Both
        !           108: .Ar srcdir
        !           109: and
        !           110: .Ar dstdir
        !           111: are mandatory.
        !           112: .It missing argument: dstdir
        !           113: Only one argument was provided.
        !           114: The second argument,
        !           115: .Ar dstdir ,
        !           116: is mandatory, too.
        !           117: .It too many arguments: Ar third argument
        !           118: Three or more arguments were provided, but only two are supported.
1.9       schwarze  119: .It Sy socketpair : Ar reason
                    120: The sockets needed for communication with
                    121: .Xr mandocd 8
                    122: could not be created, for example due to file descriptor or memory exhaustion.
                    123: .It Sy fork : Ar reason
                    124: The new process needed to run
                    125: .Xr mandocd 8
                    126: could not be created, for example due to process table exhaustion
                    127: or system resource limits.
                    128: .It Sy exec Ns Po Sy mandocd Pc : Ar reason
                    129: The
                    130: .Xr mandocd 8
                    131: child program could not be started, for example because it is not in the
                    132: .Ev PATH
                    133: or has no execute permission.
                    134: .It Sy open No destination Ar dstdir : reason
                    135: The
                    136: .Ar dstdir
                    137: could not be opened for reading, for example because it does not exist,
                    138: it is not a directory, or permission is denied.
                    139: .It Sy chdir No to source Ar srcdir : reason
                    140: The current working directory could not be changed to
                    141: .Ar srcdir ,
                    142: for example because it does not exist, it is not a directory,
                    143: or permission is denied.
                    144: .It Sy fts_open : Ar reason
                    145: Starting the iteration was attempted, but failed.
                    146: .El
                    147: .Pp
                    148: Some fatal errors cause the iteration over input files to be aborted
                    149: prematurely:
                    150: .Bl -tag -width Ds -offset indent
                    151: .It FATAL: Sy fts_read : Ar reason
                    152: A call to
                    153: .Xr fts_read 3
                    154: returned
                    155: .Dv NULL ,
                    156: meaning that the iteration failed before being complete.
                    157: .It FATAL: Sy sendmsg : Ar reason
                    158: The file descriptors needed to process one of the manual pages
                    159: could not be sent to
                    160: .Xr mandocd 8 ,
                    161: for example because
                    162: .Xr mandocd 8
                    163: could not be started or died unexpectedly.
                    164: .El
                    165: .Pp
                    166: Some non-fatal errors cause a single subdirectory to be skipped.
                    167: The iteration is not aborted but continues with the next subdirectory,
                    168: and the exit status is unaffected:
                    169: .Bl -tag -width Ds -offset indent
                    170: .It directory Ar subdirectory No unreadable : Ar reason
                    171: A directory below
                    172: .Ar srcdir
                    173: could not be read and is skipped.
                    174: .It directory Ar subdirectory No causes cycle
                    175: A directory below
                    176: .Ar srcdir
                    177: is skipped because it would cause cyclic processing.
                    178: .It Sy mkdirat Ar subdirectory : reason
                    179: A required directory below
                    180: .Ar dstdir
                    181: does not exist and could not be created.
                    182: The corresponding subdirectory below
                    183: .Ar srcdir
                    184: is skipped.
                    185: .El
                    186: .Pp
                    187: Some non-fatal errors cause a single source file to be skipped.
                    188: The iteration is not aborted but continues with the next file,
                    189: and the exit status is unaffected:
                    190: .Pp
                    191: .Bl -tag -width Ds -offset indent
                    192: .It file Ar filename : reason
                    193: The function
                    194: .Xr fts_read 3
                    195: reported a non-fatal error with respect to
                    196: .Ar filename .
1.10    ! schwarze  197: .It file Ar filename : No not a regular file
1.9       schwarze  198: For example, it might be a symbolic link or a device file.
                    199: .It Sy open Ar filename No for reading : Ar reason
                    200: A file below
1.7       schwarze  201: .Ar srcdir
1.9       schwarze  202: could not be read, for example due to permission problems.
                    203: .It Sy openat Ar filename No for writing : Ar reason
                    204: A file below
1.7       schwarze  205: .Ar dstdir
1.9       schwarze  206: could not be created or truncated, for example due to permission problems.
1.1       kristaps  207: .El
                    208: .Pp
1.9       schwarze  209: If errors occur, the applicable summary messages appear
                    210: after the end of the iteration:
                    211: .Pp
                    212: .Bl -tag -width Ds -offset indent -compact
                    213: .It skipped Ar number No directories due to errors
                    214: .It skipped Ar number No files due to errors
                    215: .It processing aborted due to fatal error
                    216: .El
1.1       kristaps  217: .Sh SEE ALSO
                    218: .Xr mandoc 1 ,
1.7       schwarze  219: .Xr mandocd 8
                    220: .Sh HISTORY
                    221: A
                    222: .Nm
                    223: utility first appeared in
                    224: .Fx 1.0 .
                    225: Other, incompatible implementations appeared in
                    226: .Nx 1.0
                    227: and in
                    228: .Sy man-db No 2.2 .
                    229: .Pp
                    230: This version appeared in version 1.14.1 of the
                    231: .Sy mandoc
                    232: toolkit.
1.1       kristaps  233: .Sh AUTHORS
1.7       schwarze  234: .An -nosplit
                    235: The first
                    236: .Nm
                    237: implementation was a short shell script by
                    238: .An Christoph Robitschko
                    239: in July 1993.
                    240: .Pp
1.1       kristaps  241: The
1.7       schwarze  242: .Nx
                    243: implementations were written by
                    244: .An J. T. Conklin Aq Mt jtc@netbsd.org
                    245: in 1993,
                    246: .An Christian E. Hopps Aq Mt chopps@netbsd.org
                    247: in 1994,
                    248: and
                    249: .An Dante Profeta Aq Mt dante@netbsd.org
                    250: in 1999; the
                    251: .Sy man-db
                    252: implementation by
                    253: .An Graeme W. Wilford
                    254: in 1994; and the
                    255: .Fx
                    256: implementations by
                    257: .An Wolfram Schneider Aq Mt wosch@freebsd.org
                    258: in 1995 and
                    259: .An John Rochester Aq Mt john@jrochester.org
                    260: in 2002.
                    261: .Pp
                    262: The concept of the present version was designed and implemented by
                    263: .An Michael Stapelberg Aq Mt stapelberg@debian.org
                    264: in 2017.
                    265: Option and argument handling and directory iteration was added by
                    266: .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
                    267: .Sh CAVEATS
                    268: All versions of
                    269: .Nm
                    270: are incompatible with each other because each caters to the needs
                    271: of a specific operating system, for example regarding directory
                    272: structures and file naming conventions.
                    273: .Pp
                    274: This version is more flexible than the others in so far as it does
                    275: not assume any particular directory structure or naming convention.
                    276: That flexibility comes at the price of not being able to change the
                    277: names and relative paths of the source files when reusing them to
                    278: store the formatted files, of not supporting any configuration file
                    279: formats or environment variables, and of being unable to scan for
                    280: and remove junk files in
                    281: .Ar dstdir .
                    282: .Pp
                    283: Currently,
1.1       kristaps  284: .Nm
1.7       schwarze  285: always reformats each page, even if the formatted version is newer
                    286: than the source version.

CVSweb