summaryrefslogtreecommitdiff
path: root/comments/comments.1
blob: 3b78686cc9b2455d48641a124997ef7d9f380601 (plain)
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
140
141
142
143
144
145
146
147
148
.TH comments 1
.SH NAME
comments - comments is an open source, C/C++ de-commentor. It will
remove all comments  and output them to a different file.

.SH SYNOPSIS
comments <options> [file1] <options> <file2> <etc>
       -r            Don't remove CR/LF
       -c            Only remove comments
       -o            Output to stdout code and stderr comments
       -n            Append newline to source
       -x            Null out options
       -d            Keep spaces in preprocessor entries
       -l            Do no mangling
       -m            Place markers where code or comments are
       -t            Print summary in tab delimited form
       -C            Print summary in comma delimited form
       -v            Print version
.SH DESCRIPTION
.B Comments
is a programming utility used to strip all comments and/or formatting from C/C++ code. It has a variety of command line
options that make it a powerful utility.
.SH NOTES
.B Options

Enabling options in comments is simple and straightforward. Here is an
example of how to just remove the comments from a source:

.B ~# comments -c foo.cpp

More advanced features are like the ability to change the options on each
file, here is an example of how to remove the comments from one source,   
output to stdout, but remove everything from the second source.

.B ~# comments -co foo.cpp -x bar.cpp

The '-x' option makes comments remove all options. Here is an example similar
to the one above, but it instead leaves the CR/LF's in the second source.

.B ~# comments -co foo.cpp -xr bar.cpp

As you can see, the '-x' option was used first to remove all current
options, and then the '-r' option was appended to make comments keep the
CR/LF's.

If you don't specify any options to a file, it will use the previous files
options.

.B ~# comments -co foo.cpp bar.cpp

That command will use the '-co' options for both foo.cpp and bar.cpp

.SH OPTIONS

.TP
.B     -r            Don't remove CR/LF

With this option enabled, and no others, it will remove everything but line feeds.

.TP
.B     -c            Only remove comments

With this option enabled, and no others, it will remove only comments from the source.

.TP
.B     -o            Output to stdout

This option specifies the output to be printed to STDOUT. This is used primarily if you wish to redirect the data.

.TP
.B     -n            Append newline to source

This option will make comments append a newline to the end of the source file. This is used by some people using C source code because some C compilers complan about not having a newline at the end of the source.

.TP
.B     -x            Null out options

This option NULLs out all previous options so that other may be specified.

.TP
.B     -d            Keep spaces in preprocessor entries

This option makes comments not do any reformatting of preprocessor entries.

.TP
.B     -l            Do no mangling

This option tells comments not to comments the input at all. This option was only included for completeness.

.TP
.B     -m            Place markers in output

This option tells comments to place CODE and /****/ where code or
comments are supposed to be in their corresponding outputs

.TP
.B     -t            Print summary in tab delimited form
.TP
.B     -C            Print summary in comma delimited form

This option makes comments print the summary information in tabular form for easier input into other programs.

Example output:

root@biz:~/comments# comments -t dformat.h
.RS
1       dformat.h       dformat.h.commentsd       1147    565     50.7411

Explanation of each column:
.RS
.RE
1: The number of the file in order (1, 2, 3, etc).
.RS
.RE
2: Name of the input file.
.RS
.RE
3: Name of the output file.
.RS
.RE
4: Original size of the input (bytes).
.RS
.RE
5: Output size (bytes).
.RS
.RE
6: Percentage of reduction calculated by (100(output_bytes/input_bytes))
.RS
.RE

.I NOTE:
If the '-o' option (output to stdout) option is given with '-t', the third column will be NULL.
.RS
.RE
root@biz:~/comments# comments -to main.cpp >output_file
.RS
.RE
1       main.cpp                844     368     56.3981
.RE

.TP
.B     -v            Print version

This option causes comments to print the version info and exit immediately.

.SH BUGS
None known. Email bug reports to
.B biz@biz0r.biz