xref: /minix/usr.bin/uuencode/uuencode.1 (revision 83133719)
1.\"	$NetBSD: uuencode.1,v 1.26 2014/09/06 21:21:36 wiz Exp $
2.\"
3.\" Copyright (c) 1980, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)uuencode.1	8.1 (Berkeley) 6/6/93
31.\"
32.Dd September 6, 2014
33.Dt UUENCODE 1
34.Os
35.Sh NAME
36.Nm uuencode ,
37.Nm uudecode
38.Nd encode/decode a binary file
39.Sh SYNOPSIS
40.Nm
41.Op Fl m
42.Op Ar inputfile
43.Ar headername
44.Nm uudecode
45.Op Fl m
46.Op Fl p | Fl o Ar outputfile
47.Op Ar encoded-file ...
48.Sh DESCRIPTION
49.Nm
50and
51.Nm uudecode
52are used to transmit binary files over transmission mediums
53that do not support other than simple
54.Tn ASCII
55data.
56.Pp
57The following options are available:
58.Bl -tag -width ".Fl m"
59.It Fl m
60Use base64 encoding.
61For
62.Nm ,
63the historical uuencode algorithm is the default.
64For
65.Nm uudecode ,
66by default the encoding is automatically detected.
67.It Fl o Ar outputfile
68.Po Nm uudecode No only . Pc
69Send the decoded output data to
70.Ar outputfile .
71By default,
72.Nm uudecode
73uses the
74.Ar headername
75recorded in the header of the encoded data stream.
76.It Fl p
77.Po Nm uudecode No only . Pc
78Write the decoded file to standard output instead of to a file.
79.El
80.Pp
81.Nm
82reads
83.Ar inputfile
84(or by default the standard input) and writes an encoded version
85to (always) the standard output.
86The encoding uses only printing
87.Tn ASCII
88characters suitable for text-only transport media.
89The string
90.Ar headername
91is inserted into the output header as the
92.Ar outputfile
93to use at
94.Nm uudecode
95time.
96The header also includes the mode (permissions) of the file.
97.Pp
98.Nm uudecode
99transforms
100.Em uuencoded
101files (or by default, the standard input) into the original form.
102The resulting file is named
103.Ar headername
104as recorded in the encoded file,
105or as specified by the
106.Fl o
107option,
108and will have the mode of the original file except that setuid
109and execute bits are not retained.
110If the
111.Fl p
112option is specified, or if the output file name is given as
113.Pa /dev/stdout ,
114then the data will be written to the standard output
115instead of to a named file.
116.Nm uudecode
117ignores any leading and trailing lines.
118.Pp
119The encoded form of the file is expanded by 35%.
120Every 3 bytes become 4 plus control information.
121.Sh EXIT STATUS
122The
123.Nm uudecode
124and
125.Nm
126utilities exits 0 on success, and \*[Gt]0 if an error occurs.
127.Sh EXAMPLES
128The following example packages up a source tree, compresses it,
129uuencodes it and mails it to a user on another system.
130.Pp
131.Bd -literal -offset indent -compact
132tar czf \- src_tree \&| uuencode src_tree.tgz \&| mail user@example.com
133.Ed
134.Pp
135On the other system, if the user saves the mail to the file
136.Pa temp ,
137the following example creates the file
138.Pa src_tree.tgz
139and extracts it to make a copy of the original tree.
140.Pp
141.Bd -literal -offset indent -compact
142uudecode temp
143tar xzf src_tree.tgz
144.Ed
145.Sh SEE ALSO
146.Xr gzip 1 ,
147.Xr mail 1 ,
148.Xr tar 1 ,
149.\".Xr uucp 1 ,
150.Xr uuencode 5
151.Sh STANDARDS
152The
153.Nm uudecode
154and
155.Nm
156utilities conform to
157.St -p1003.1-2008 .
158.Sh HISTORY
159The
160.Nm uudecode
161and
162.Nm
163utilities appeared in
164.Bx 4.0 .
165.Sh SECURITY CONSIDERATIONS
166When using
167.Nm uudecode
168with files coming from dubious sources,
169always either explicitly pass the
170.Fl o
171option or check the header (the first line) of the encoded file for
172safety.
173Blindly using a
174.Ar headername
175from a hostile source can overwrite important files.
176