1src2man(1)                                                          src2man(1)
2
3
4

NAME

6       src2man - extract man pages from source files.
7

SYNOPSIS

9       src2man [-n][-d date][-v volume][-r release] [srcfile ...]
10

DESCRIPTION

12       src2man  scans  source  file srcfile. Only C source files are supported
13       for now. Comments blocks starting by "/** num", where num is a  section
14       number, are converted into a man file, using txt2man(1).
15
16       The  first  line of the comment block must contain the name of the man‐
17       page, usually the function name, followed by a "-" and a short descrip‐
18       tion. The following lines are the "DESCRIPTION" section content, except
19       if they are in upper case, in which case they define a new section.
20
21       If the next line after a comment block is  empty,  Then  no  "SYNOPSIS"
22       section  will be generated. Otherwise, src2man will look in the follow‐
23       ing source lines for a function prototype or a type  definion  (struct,
24       union,  typedef,  ...)  matching  the manpage name, and include it in a
25       "SYNOPSIS" section. This avoids to duplicate the type or function  pro‐
26       totype in the comment block.
27
28       The  best place for code documentation is in the source file, where the
29       body is implemented, not the header file which only contains the proto‐
30       type. src2man automatically searches for the presence of a prototype in
31       the corresponding header file, and if found, will  print  a  "#include"
32       statement in the synopsis.
33

OPTIONS

35       -d date
36              Set the date of the man pages. Defaults to current date.
37
38       -n     No  man  page is created. The name of the manpages that would be
39              created are printed.
40
41       -v volume
42              Specify the name of the volume to be printed in center header of
43              generated manpages.
44
45       -r release
46              Specify  the  project  name and release number for the generated
47              manpage.
48

ENVIRONMENT

50       SOURCE_DATE_EPOCH
51              Unix timestamp that is used for date in header instead  of  cur‐
52              rent date.
53

EXAMPLE

55       The  following  example displays C code and comments to generate a man‐
56       page foobar.3:
57
58   /** 3
59       •  foobar - a sample dummy function
60
61       •  This line is now the first of the description section.
62
63       •  Note that function parameters parm1 and parm2 are highlighted
64
65       •  in the generated man page.
66
67   */
68       int foobar(char *parm1, int parm2)
69
70   {
71   ...
72       return 0;
73
74   }

SEE ALSO

76       txt2man(1), bookman(1).
77

AUTHOR

79       Marc Vertes <mvertes@free.fr>
80
81
82
83txt2man-1.7.1                   22 January 2022                     src2man(1)
Impressum