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.\" @(#)uuencode.1 8.1 (Berkeley) 6/6/93 29.\" $FreeBSD: src/usr.bin/uuencode/uuencode.1,v 1.9.2.9 2003/04/07 20:11:46 fanf Exp $ 30.\" 31.Dd January 27, 2002 32.Dt UUENCODE 1 33.Os 34.Sh NAME 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 Fl m 43.Op Fl o Ar output_file 44.Op Ar file 45.Ar name 46.Nm uudecode 47.Op Fl cimprs 48.Op Ar 49.Nm uudecode 50.Op Fl i 51.Fl o Ar output_file 52.Nm b64encode 53.Op Fl o Ar output_file 54.Op Ar file 55.Ar name 56.Nm b64decode 57.Op Fl cimprs 58.Op Ar 59.Nm b64decode 60.Op Fl i 61.Fl o Ar output_file 62.Op Ar file 63.Sh DESCRIPTION 64The 65.Nm 66and 67.Nm uudecode 68utilities are used to transmit binary files over transmission mediums 69that do not support other than simple 70.Tn ASCII 71data. 72The 73.Nm b64encode 74utility is synonymous with 75.Nm 76with the 77.Fl m 78flag specified. 79The 80.Nm b64decode 81utility is synonymous with 82.Nm uudecode 83with the 84.Fl m 85flag specified. 86.Pp 87The 88.Nm 89utility reads 90.Ar file 91(or by default the standard input) and writes an encoded version 92to the standard output, or 93.Ar output_file 94if one has been specified. 95The encoding uses only printing 96.Tn ASCII 97characters and includes the 98mode of the file and the operand 99.Ar name 100for use by 101.Nm uudecode . 102.Pp 103The 104.Nm uudecode 105utility transforms 106.Em uuencoded 107files (or by default, the standard input) into the original form. 108The resulting file is named either 109.Ar name 110or (depending on options passed to 111.Nm uudecode ) 112.Ar output_file 113and will have the mode of the original file except that setuid 114and execute bits are not retained. 115The 116.Nm uudecode 117utility ignores any leading and trailing lines. 118.Pp 119The following options are available for 120.Nm : 121.Bl -tag -width ident 122.It Fl m 123Use the Base64 method of encoding, rather than the traditional 124.Nm 125algorithm. 126.It Fl o Ar output_file 127Output to 128.Ar output_file 129instead of standard output. 130.El 131.Pp 132The following options are available for 133.Nm uudecode : 134.Bl -tag -width ident 135.It Fl c 136Decode more than one uuencoded file from 137.Ar file 138if possible. 139.It Fl i 140Do not overwrite files. 141.It Fl m 142When used with the 143.Fl r 144flag, decode Base64 input instead of traditional 145.Nm 146input. 147Without 148.Fl r 149it has no effect. 150.It Fl o Ar output_file 151Output to 152.Ar output_file 153instead of any pathname contained in the input data. 154.It Fl p 155Decode 156.Ar file 157and write output to standard output. 158.It Fl r 159Decode raw (or broken) input, which is missing the initial and 160possibly the final framing lines. 161The input is assumed to be in the traditional 162.Nm 163encoding, but if the 164.Fl m 165flag is used, or if the utility is invoked as 166.Nm b64decode , 167then the input is assumed to be in Base64 format. 168.It Fl s 169Do not strip output pathname to base filename. 170By default 171.Nm uudecode 172deletes any prefix ending with the last slash '/' for security 173reasons. 174.El 175.Sh EXAMPLES 176The following example packages up a source tree, compresses it, 177uuencodes it and mails it to a user on another system. 178When 179.Nm uudecode 180is run on the target system, the file ``src_tree.tar.Z'' will be 181created which may then be uncompressed and extracted into the original 182tree. 183.Pp 184.Bd -literal -offset indent -compact 185tar cf \- src_tree \&| compress \&| 186uuencode src_tree.tar.Z \&| mail sys1!sys2!user 187.Ed 188.Pp 189The following example unpacks all uuencoded 190files from your mailbox into your current working directory. 191.Pp 192.Bd -literal -offset indent -compact 193uudecode -c < $MAIL 194.Ed 195.Pp 196The following example extracts a compressed tar 197archive from your mailbox 198.Pp 199.Bd -literal -offset indent -compact 200uudecode -o /dev/stdout < $MAIL | zcat | tar xfv - 201.Ed 202.Sh SEE ALSO 203.Xr basename 1 , 204.Xr compress 1 , 205.Xr mail 1 , 206.Xr uucp 1 Pq Pa net/freebsd-uucp , 207.Xr uuencode 5 208.Sh HISTORY 209The 210.Nm uudecode 211and 212.Nm 213utilities appeared in 214.Bx 4.0 . 215.Sh BUGS 216Files encoded using the traditional algorithm are expanded by 35% (3 217bytes become 4 plus control information). 218