Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | =head1 NAME |
michael@0 | 6 | |
michael@0 | 7 | basecvt - radix conversion for arbitrary precision integers |
michael@0 | 8 | |
michael@0 | 9 | =head1 SYNOPSIS |
michael@0 | 10 | |
michael@0 | 11 | basecvt <ibase> <obase> [values] |
michael@0 | 12 | |
michael@0 | 13 | =head1 DESCRIPTION |
michael@0 | 14 | |
michael@0 | 15 | The B<basecvt> program is a command-line tool for converting integers |
michael@0 | 16 | of arbitrary precision from one radix to another. The current version |
michael@0 | 17 | supports radix values from 2 (binary) to 64, inclusive. The first two |
michael@0 | 18 | command line arguments specify the input and output radix, in base 10. |
michael@0 | 19 | Any further arguments are taken to be integers notated in the input |
michael@0 | 20 | radix, and these are converted to the output radix. The output is |
michael@0 | 21 | written, one integer per line, to standard output. |
michael@0 | 22 | |
michael@0 | 23 | When reading integers, only digits considered "valid" for the input |
michael@0 | 24 | radix are considered. Processing of an integer terminates when an |
michael@0 | 25 | invalid input digit is encountered. So, for example, if you set the |
michael@0 | 26 | input radix to 10 and enter '10ACF', B<basecvt> would assume that you |
michael@0 | 27 | had entered '10' and ignore the rest of the string. |
michael@0 | 28 | |
michael@0 | 29 | If no values are provided, no output is written, but the program |
michael@0 | 30 | simply terminates with a zero exit status. Error diagnostics are |
michael@0 | 31 | written to standard error in the event of out-of-range radix |
michael@0 | 32 | specifications. Regardless of the actual values of the input and |
michael@0 | 33 | output radix, the radix arguments are taken to be in base 10 (decimal) |
michael@0 | 34 | notation. |
michael@0 | 35 | |
michael@0 | 36 | =head1 DIGITS |
michael@0 | 37 | |
michael@0 | 38 | For radices from 2-10, standard ASCII decimal digits 0-9 are used for |
michael@0 | 39 | both input and output. For radices from 11-36, the ASCII letters A-Z |
michael@0 | 40 | are also included, following the convention used in hexadecimal. In |
michael@0 | 41 | this range, input is accepted in either upper or lower case, although |
michael@0 | 42 | on output only lower-case letters are used. |
michael@0 | 43 | |
michael@0 | 44 | For radices from 37-62, the output includes both upper- and lower-case |
michael@0 | 45 | ASCII letters, and case matters. In this range, case is distinguished |
michael@0 | 46 | both for input and for output values. |
michael@0 | 47 | |
michael@0 | 48 | For radices 63 and 64, the characters '+' (plus) and '/' (forward |
michael@0 | 49 | solidus) are also used. These are derived from the MIME base64 |
michael@0 | 50 | encoding scheme. The overall encoding is not the same as base64, |
michael@0 | 51 | because the ASCII digits are used for the bottom of the range, and the |
michael@0 | 52 | letters are shifted upward; however, the output will consist of the |
michael@0 | 53 | same character set. |
michael@0 | 54 | |
michael@0 | 55 | This input and output behaviour is inherited from the MPI library used |
michael@0 | 56 | by B<basecvt>, and so is not configurable at runtime. |
michael@0 | 57 | |
michael@0 | 58 | =head1 SEE ALSO |
michael@0 | 59 | |
michael@0 | 60 | dec2hex(1), hex2dec(1) |
michael@0 | 61 | |
michael@0 | 62 | =head1 AUTHOR |
michael@0 | 63 | |
michael@0 | 64 | Michael J. Fromberger <sting@linguist.dartmouth.edu> |
michael@0 | 65 | Thayer School of Engineering, Hanover, New Hampshire, USA |