xref: /freebsd/usr.bin/bintrans/bintrans.1 (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1.\" Copyright (c) 1980, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     From: @(#)uuencode.1	8.1 (Berkeley) 6/6/93
29.\"
30.Dd April 18, 2022
31.Dt BINTRANS 1
32.Os
33.Sh NAME
34.Nm bintrans ,
35.Nm uuencode ,
36.Nm uudecode ,
37.Nm b64encode ,
38.Nm b64decode
39.Nd encode/decode a binary file
40.Sh SYNOPSIS
41.Nm
42.Op algorithm
43.Op ...
44.Nm uuencode
45.Op Fl m
46.Op Fl r
47.Op Fl o Ar output_file
48.Op Ar file
49.Ar name
50.Nm uudecode
51.Op Fl cimprs
52.Op Ar
53.Nm uudecode
54.Op Fl i
55.Fl o Ar output_file
56.Nm b64encode
57.Op Fl r
58.Op Fl w Ar column
59.Op Fl o Ar output_file
60.Op Ar file
61.Ar name
62.Nm b64decode
63.Op Fl cimprs
64.Op Ar
65.Nm b64decode
66.Op Fl i
67.Fl o Ar output_file
68.Op Ar file
69.Nm base64
70.Op Fl d
71.Op Fl w Ar column
72.Op Ar file
73.Sh DESCRIPTION
74The
75.Nm uuencode
76and
77.Nm uudecode
78utilities are used to transmit binary files over transmission mediums
79that do not support other than simple
80.Tn ASCII
81data.
82The
83.Nm b64encode
84utility is synonymous with
85.Nm uuencode
86with the
87.Fl m
88flag specified.
89The
90.Nm b64decode
91utility is synonymous with
92.Nm uudecode
93with the
94.Fl m
95flag specified.
96.Pp
97The
98.Nm base64
99utility acts as a base64 decoder when passed the
100.Fl -decode
101.Po or
102.Fl d
103.Pc
104flag and as a base64 encoder otherwise.
105As a decoder it only accepts raw base64 input
106and as an encoder it does not produce the framing lines.
107.Nm base64
108reads standard input or
109.Ar file
110if it is provided and writes to standard output.
111Options
112.Fl -wrap
113.Po or
114.Fl w
115.Pc
116and
117.Fl -ignore-garbage
118.Po or
119.Fl i
120.Pc
121are accepted for compatibility with GNU base64,
122but the latter is unimplemented and silently ignored.
123.Pp
124The
125.Nm uuencode
126utility reads
127.Ar file
128(or by default the standard input) and writes an encoded version
129to the standard output, or
130.Ar output_file
131if one has been specified.
132The encoding uses only printing
133.Tn ASCII
134characters and includes the
135mode of the file and the operand
136.Ar name
137for use by
138.Nm uudecode .
139.Pp
140The
141.Nm uudecode
142utility transforms
143.Em uuencoded
144files (or by default, the standard input) into the original form.
145The resulting file is named either
146.Ar name
147or (depending on options passed to
148.Nm uudecode )
149.Ar output_file
150and will have the mode of the original file except that setuid
151and execute bits are not retained.
152The
153.Nm uudecode
154utility ignores any leading and trailing lines.
155.Pp
156The following options are available for
157.Nm uuencode :
158.Bl -tag -width ident
159.It Fl m
160Use the Base64 method of encoding, rather than the traditional
161.Nm uuencode
162algorithm.
163.It Fl r
164Produce raw output by excluding the initial and final framing lines.
165.It Fl o Ar output_file
166Output to
167.Ar output_file
168instead of standard output.
169.El
170.Pp
171The following options are available for
172.Nm uudecode :
173.Bl -tag -width ident
174.It Fl c
175Decode more than one uuencoded file from
176.Ar file
177if possible.
178.It Fl i
179Do not overwrite files.
180.It Fl m
181When used with the
182.Fl r
183flag, decode Base64 input instead of traditional
184.Nm uuencode
185input.
186Without
187.Fl r
188it has no effect.
189.It Fl o Ar output_file
190Output to
191.Ar output_file
192instead of any pathname contained in the input data.
193.It Fl p
194Decode
195.Ar file
196and write output to standard output.
197.It Fl r
198Decode raw (or broken) input, which is missing the initial and
199possibly the final framing lines.
200The input is assumed to be in the traditional
201.Nm uuencode
202encoding, but if the
203.Fl m
204flag is used, or if the utility is invoked as
205.Nm b64decode ,
206then the input is assumed to be in Base64 format.
207.It Fl s
208Do not strip output pathname to base filename.
209By default
210.Nm uudecode
211deletes any prefix ending with the last slash '/' for security
212reasons.
213.El
214.Pp
215Additionally,
216.Nm b64encode
217accepts the following option:
218.Bl -tag -width ident
219.It Fl w Ar column
220Wrap encoded output after
221.Ar column .
222.El
223.Pp
224.Nm
225is a generic utility that can run
226any of the aforementioned encoders and decoders.
227It can also run algorithms that are not available
228through a dedicated program:
229.Pp
230.Nm qp
231is a quoted-printable converter
232and accepts the following options:
233.Bl -tag -width ident
234.It Fl u
235Decode.
236.It Fl o Ar output_file
237Output to
238.Ar output_file
239instead of standard output.
240.Sh EXAMPLES
241The following example packages up a source tree, compresses it,
242uuencodes it and mails it to a user on another system.
243When
244.Nm uudecode
245is run on the target system, the file ``src_tree.tar.Z'' will be
246created which may then be uncompressed and extracted into the original
247tree.
248.Pp
249.Bd -literal -offset indent -compact
250tar cf \- src_tree \&| compress \&|
251uuencode src_tree.tar.Z \&| mail user@example.com
252.Ed
253.Pp
254The following example unpacks all uuencoded
255files from your mailbox into your current working directory.
256.Pp
257.Bd -literal -offset indent -compact
258uudecode -c < $MAIL
259.Ed
260.Pp
261The following example extracts a compressed tar
262archive from your mailbox
263.Pp
264.Bd -literal -offset indent -compact
265uudecode -o /dev/stdout < $MAIL | zcat | tar xfv -
266.Ed
267.Sh SEE ALSO
268.Xr basename 1 ,
269.Xr compress 1 ,
270.Xr mail 1 ,
271.Xr uucp 1 Pq Pa ports/net/freebsd-uucp ,
272.Xr uuencode 5
273.Sh HISTORY
274The
275.Nm uudecode
276and
277.Nm uuencode
278utilities appeared in
279.Bx 4.0 .
280.Sh BUGS
281Files encoded using the traditional algorithm are expanded by 35% (3
282bytes become 4 plus control information).
283