logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

uuencode.1p (12657B)


  1. '\" et
  2. .TH UUENCODE "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. uuencode
  12. \(em encode a binary file
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. uuencode \fB[\fR-m\fB] [\fIfile\fB] \fIdecode_pathname\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR uuencode
  21. utility shall write an encoded version of the named input file, or
  22. standard input if no
  23. .IR file
  24. is specified, to standard output. The output shall be encoded using
  25. one of the algorithms described in the STDOUT section and shall
  26. include the file access permission bits (in
  27. .IR chmod
  28. octal or symbolic notation) of the input file and the
  29. .IR decode_pathname ,
  30. for re-creation of the file on another system that conforms to this volume of POSIX.1\(hy2017.
  31. .SH OPTIONS
  32. The
  33. .IR uuencode
  34. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  35. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  36. .P
  37. The following option shall be supported by the implementation:
  38. .IP "\fB\-m\fP" 10
  39. Encode the output using the MIME Base64 algorithm described in STDOUT.
  40. If
  41. .BR \-m
  42. is not specified, the historical algorithm described in STDOUT shall be
  43. used.
  44. .SH OPERANDS
  45. The following operands shall be supported:
  46. .IP "\fIdecode_pathname\fR" 10
  47. .br
  48. The pathname of the file into which the
  49. .IR uudecode
  50. utility shall place the decoded file. Specifying a
  51. .IR decode_pathname
  52. operand of
  53. .BR /dev/stdout
  54. shall indicate that
  55. .IR uudecode
  56. is to use standard output. If there are characters in
  57. .IR decode_pathname
  58. that are not in the portable filename character set the results are
  59. unspecified.
  60. .IP "\fIfile\fR" 10
  61. A pathname of the file to be encoded.
  62. .SH STDIN
  63. See the INPUT FILES section.
  64. .SH "INPUT FILES"
  65. Input files can be files of any type.
  66. .SH "ENVIRONMENT VARIABLES"
  67. The following environment variables shall affect the execution of
  68. .IR uuencode :
  69. .IP "\fILANG\fP" 10
  70. Provide a default value for the internationalization variables that are
  71. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  72. .IR "Section 8.2" ", " "Internationalization Variables"
  73. for the precedence of internationalization variables used to determine
  74. the values of locale categories.)
  75. .IP "\fILC_ALL\fP" 10
  76. If set to a non-empty string value, override the values of all the
  77. other internationalization variables.
  78. .IP "\fILC_CTYPE\fP" 10
  79. Determine the locale for the interpretation of sequences of bytes of
  80. text data as characters (for example, single-byte as opposed to
  81. multi-byte characters in arguments and input files).
  82. .IP "\fILC_MESSAGES\fP" 10
  83. .br
  84. Determine the locale that should be used to affect the format and
  85. contents of diagnostic messages written to standard error.
  86. .IP "\fINLSPATH\fP" 10
  87. Determine the location of message catalogs for the processing of
  88. .IR LC_MESSAGES .
  89. .SH "ASYNCHRONOUS EVENTS"
  90. Default.
  91. .SH STDOUT
  92. .SS "uuencode Base64 Algorithm"
  93. .P
  94. The standard output shall be a text file (encoded in the character set
  95. of the current locale) that begins with the line:
  96. .sp
  97. .RS 4
  98. .nf
  99. "begin-base64 %s %s\en", <\fImode\fR>, <\fIdecode_pathname\fR>
  100. .fi
  101. .P
  102. .RE
  103. .P
  104. and ends with the line:
  105. .sp
  106. .RS 4
  107. .nf
  108. "====\en"
  109. .fi
  110. .P
  111. .RE
  112. .P
  113. In both cases, the lines shall have no preceding or trailing
  114. <blank>
  115. characters.
  116. .P
  117. The encoding process represents 24-bit groups of input bits as output
  118. strings of four encoded characters. Proceeding from left to right, a
  119. 24-bit input group shall be formed by concatenating three 8-bit input
  120. groups. Each 24-bit input group then shall be treated as four
  121. concatenated 6-bit groups, each of which shall be translated into a
  122. single digit in the Base64 alphabet. When encoding a bit stream via the
  123. Base64 encoding, the bit stream shall be presumed to be ordered with
  124. the most-significant bit first. That is, the first bit in the stream
  125. shall be the high-order bit in the first byte, and the eighth bit shall
  126. be the low-order bit in the first byte, and so on. Each 6-bit group is
  127. used as an index into an array of 64 printable characters, as shown in
  128. .IR "Table 4-22, uuencode Base64 Values".
  129. .sp
  130. .ce 1
  131. \fBTable 4-22: uuencode Base64 Values\fR
  132. .TS
  133. center box tab(!);
  134. cB | cB || cB | cB || cB | cB || cB | cB
  135. n | cf5 || n | cf5 || n | cf5 || n | cf5.
  136. Value!Encoding!Value!Encoding!Value!Encoding!Value!Encoding
  137. _
  138. 0!A!17!R!34!i!51!z
  139. 1!B!18!S!35!j!52!0
  140. 2!C!19!T!36!k!53!1
  141. 3!D!20!U!37!l!54!2
  142. 4!E!21!V!38!m!55!3
  143. 5!F!22!W!39!n!56!4
  144. 6!G!23!X!40!o!57!5
  145. 7!H!24!Y!41!p!58!6
  146. 8!I!25!Z!42!q!59!7
  147. 9!J!26!a!43!r!60!8
  148. 10!K!27!b!44!s!61!9
  149. 11!L!28!c!45!t!62!+
  150. 12!M!29!d!46!u!63!/
  151. 13!N!30!e!47!v
  152. 14!O!31!f!48!w!(pad)!\&=
  153. 15!P!32!g!49!x
  154. 16!Q!33!h!50!y
  155. .TE
  156. .P
  157. The character referenced by the index shall be placed in the output
  158. string.
  159. .P
  160. The output stream (encoded bytes) shall be represented in lines of no
  161. more than 76 characters each. All line breaks or other characters not
  162. found in the table shall be ignored by decoding software (see
  163. .IR "\fIuudecode\fR\^").
  164. .P
  165. Special processing shall be performed if fewer than 24 bits are
  166. available at the end of a message or encapsulated part of a message. A
  167. full encoding quantum shall always be completed at the end of a
  168. message. When fewer than 24 input bits are available in an input group,
  169. zero bits shall be added (on the right) to form an integral number of
  170. 6-bit groups. Output character positions that are not required to
  171. represent actual input data shall be set to the character
  172. .BR '=' .
  173. Since all Base64 input is an integral number of octets, only the
  174. following cases can arise:
  175. .IP " 1." 4
  176. The final quantum of encoding input is an integral multiple of 24 bits;
  177. here, the final unit of encoded output shall be an integral multiple of
  178. 4 characters with no
  179. .BR '='
  180. padding.
  181. .IP " 2." 4
  182. The final quantum of encoding input is exactly 16 bits; here, the final
  183. unit of encoded output shall be three characters followed by one
  184. .BR '='
  185. padding character.
  186. .IP " 3." 4
  187. The final quantum of encoding input is exactly 8 bits; here, the final
  188. unit of encoded output shall be two characters followed by two
  189. .BR '='
  190. padding characters.
  191. .P
  192. A terminating
  193. .BR \(dq====\(dq
  194. evaluates to nothing and denotes the end of the encoded data.
  195. .SS "uuencode Historical Algorithm"
  196. .P
  197. The standard output shall be a text file (encoded in the character set
  198. of the current locale) that begins with the line:
  199. .sp
  200. .RS 4
  201. .nf
  202. "begin %s %s\en" <\fImode\fR>, <\fIdecode_pathname\fR>
  203. .fi
  204. .P
  205. .RE
  206. .P
  207. and ends with the line:
  208. .sp
  209. .RS 4
  210. .nf
  211. "end\en"
  212. .fi
  213. .P
  214. .RE
  215. .P
  216. In both cases, the lines shall have no preceding or trailing
  217. <blank>
  218. characters.
  219. .P
  220. The algorithm that shall be used for lines in between
  221. .BR begin
  222. and
  223. .BR end
  224. takes three octets as input and writes four characters of output by
  225. splitting the input at six-bit intervals into four octets, containing
  226. data in the lower six bits only. These octets shall be converted to
  227. characters by adding a value of 0x20 to each octet, so that each octet
  228. is in the range [0x20,0x5f], and then it shall be assumed to represent
  229. a printable character in the ISO/IEC\ 646:\|1991 standard encoded character set. It then
  230. shall be translated into the corresponding character codes for the
  231. codeset in use in the current locale. (For example, the octet 0x41,
  232. representing
  233. .BR 'A' ,
  234. would be translated to
  235. .BR 'A'
  236. in the current codeset, such as 0xc1 if it were EBCDIC.)
  237. .P
  238. Where the bits of two octets are combined, the least significant bits
  239. of the first octet shall be shifted left and combined with the most
  240. significant bits of the second octet shifted right. Thus the three
  241. octets
  242. .IR A ,
  243. .IR B ,
  244. .IR C
  245. shall be converted into the four octets:
  246. .sp
  247. .RS 4
  248. .nf
  249. 0x20 + (( A >> 2 ) & 0x3F)
  250. 0x20 + (((A << 4) |\h\(aq\n(XX\(aq ((B >> 4) & 0xF)) & 0x3F)
  251. 0x20 + (((B << 2) |\h\(aq\n(XX\(aq ((C >> 6) & 0x3)) & 0x3F)
  252. 0x20 + (( C ) & 0x3F)
  253. .fi
  254. .P
  255. .RE
  256. .P
  257. These octets then shall be translated into the local character set.
  258. .P
  259. Each encoded line contains a length character, equal to the number of
  260. characters to be decoded plus 0x20 translated to the local character
  261. set as described above, followed by the encoded characters. The
  262. maximum number of octets to be encoded on each line shall be 45.
  263. .SH STDERR
  264. The standard error shall be used only for diagnostic messages.
  265. .SH "OUTPUT FILES"
  266. None.
  267. .SH "EXTENDED DESCRIPTION"
  268. None.
  269. .SH "EXIT STATUS"
  270. The following exit values shall be returned:
  271. .IP "\00" 6
  272. Successful completion.
  273. .IP >0 6
  274. An error occurred.
  275. .SH "CONSEQUENCES OF ERRORS"
  276. Default.
  277. .LP
  278. .IR "The following sections are informative."
  279. .SH "APPLICATION USAGE"
  280. The file is expanded by 35 percent (each three octets become four, plus
  281. control information) causing it to take longer to transmit.
  282. .P
  283. Since this utility is intended to create files to be used for data
  284. interchange between systems with possibly different codesets, and to
  285. represent binary data as a text file, the ISO/IEC\ 646:\|1991 standard was chosen for a
  286. midpoint in the algorithm as a known reference point. The output from
  287. .IR uuencode
  288. is a text file on the local system. If the output were in the ISO/IEC\ 646:\|1991 standard
  289. codeset, it might not be a text file (at least because the
  290. <newline>
  291. characters might not match), and the goal of creating a text file would
  292. be defeated. If this text file was then carried to another machine with
  293. the same codeset, it would be perfectly compatible with that system's
  294. .IR uudecode .
  295. If it was transmitted over a mail system or sent to a machine with a
  296. different codeset, it is assumed that, as for every other text file,
  297. some translation mechanism would convert it (by the time it reached a
  298. user on the other system) into an appropriate codeset. This
  299. translation only makes sense from the local codeset, not if the file
  300. has been put into a ISO/IEC\ 646:\|1991 standard representation first. Similarly, files
  301. processed by
  302. .IR uuencode
  303. can be placed in
  304. .IR pax
  305. archives, intermixed with other text files in the same codeset.
  306. .SH EXAMPLES
  307. None.
  308. .SH RATIONALE
  309. A new algorithm was added at the request of the international community
  310. to parallel work in RFC\ 2045 (MIME). As with the historical
  311. .IR uuencode
  312. format, the Base64 Content-Transfer-Encoding is designed to represent
  313. arbitrary sequences of octets in a form that is not humanly readable. A
  314. 65-character subset of the ISO/IEC\ 646:\|1991 standard is used, enabling 6 bits to be
  315. represented per printable character. (The extra 65th character,
  316. .BR '=' ,
  317. is used to signify a special processing function.)
  318. .P
  319. This subset has the important property that it is represented
  320. identically in all versions of the ISO/IEC\ 646:\|1991 standard, including US ASCII, and all
  321. characters in the subset are also represented identically in all
  322. versions of EBCDIC. The historical
  323. .IR uuencode
  324. algorithm does not share this property, which is the reason that a
  325. second algorithm was added to the ISO\ POSIX\(hy2 standard.
  326. .P
  327. The string
  328. .BR \(dq====\(dq
  329. was used for the termination instead of the end used in the original
  330. format because the latter is a string that could be valid encoded
  331. input.
  332. .P
  333. In an early draft, the
  334. .BR \-m
  335. option was named
  336. .BR \-b
  337. (for Base64), but it was renamed to reflect its relationship to the
  338. RFC\ 2045. A
  339. .BR \-u
  340. was also present to invoke the default algorithm, but since this was
  341. not historical practice, it was omitted as being unnecessary.
  342. .P
  343. See the RATIONALE section in
  344. .IR "\fIuudecode\fR\^"
  345. for the derivation of the
  346. .BR /dev/stdout
  347. symbol.
  348. .SH "FUTURE DIRECTIONS"
  349. None.
  350. .SH "SEE ALSO"
  351. .IR "\fIchmod\fR\^",
  352. .IR "\fImailx\fR\^",
  353. .IR "\fIuudecode\fR\^"
  354. .P
  355. The Base Definitions volume of POSIX.1\(hy2017,
  356. .IR "Chapter 8" ", " "Environment Variables",
  357. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  358. .\"
  359. .SH COPYRIGHT
  360. Portions of this text are reprinted and reproduced in electronic form
  361. from IEEE Std 1003.1-2017, Standard for Information Technology
  362. -- Portable Operating System Interface (POSIX), The Open Group Base
  363. Specifications Issue 7, 2018 Edition,
  364. Copyright (C) 2018 by the Institute of
  365. Electrical and Electronics Engineers, Inc and The Open Group.
  366. In the event of any discrepancy between this version and the original IEEE and
  367. The Open Group Standard, the original IEEE and The Open Group Standard
  368. is the referee document. The original Standard can be obtained online at
  369. http://www.opengroup.org/unix/online.html .
  370. .PP
  371. Any typographical or formatting errors that appear
  372. in this page are most likely
  373. to have been introduced during the conversion of the source files to
  374. man page format. To report such errors, see
  375. https://www.kernel.org/doc/man-pages/reporting_bugs.html .