socket: Allow keeping a reference on the new socket in sonewconn_faddr
[dragonfly.git] / usr.bin / units / units.1
1 .\" $FreeBSD: head/usr.bin/units/units.1 264470 2014-04-14 20:51:04Z eadler $
2 .Dd April 15, 2014
3 .Dt UNITS 1
4 .Os
5 .Sh NAME
6 .Nm units
7 .Nd conversion program
8 .Sh SYNOPSIS
9 .Nm
10 .Op Fl f Ar filename
11 .Op Fl qvUV
12 .Op Ar from-unit to-unit
13 .Sh OPTIONS
14 The following options are available:
15 .Bl -tag -width indent
16 .It Fl f Ar filename
17 Specify the name of the units data file to load.
18 .It Fl q
19 Suppress prompting of the user for units and the display of statistics
20 about the number of units loaded.
21 .It Fl U
22 If the default unit file exists prints its location.
23 If not, print
24 .Qo
25 Units data file not found
26 .Qc
27 .It Fl V
28 Print the version number, usage, and then exit.
29 .It Ar from-unit to-unit
30 Allow a single unit conversion to be done directly from the command
31 line.
32 The program will not print prompts.
33 It will print out the
34 result of the single specified conversion.
35 .It Fl v
36 Print the units in the conversion output.
37 Be more verbose in general.
38 .El
39 .Sh DESCRIPTION
40 The
41 .Nm
42 program converts quantities expressed in various scales to
43 their equivalents in other scales.
44 The
45 .Nm
46 program can only
47 handle multiplicative or affine scale changes.
48 It works interactively by prompting
49 the user for input:
50 .Bd -literal
51     You have: meters
52     You want: feet
53             * 3.2808399
54             / 0.3048
55
56     You have: cm^3
57     You want: gallons
58             * 0.00026417205
59             / 3785.4118
60
61     You have: meters/s
62     You want: furlongs/fortnight
63             * 6012.8848
64             / 0.00016630952
65
66     You have: 1|2 inch
67     You want: cm
68             * 1.27
69             / 0.78740157
70
71     You have: 85 degF
72     You want: degC
73         29.444444
74 .Ed
75 .Pp
76 Powers of units can be specified using the '^' character as shown in
77 the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
78 Multiplication of units can be specified by using spaces, a dash or
79 an asterisk.
80 Division of units is indicated by the slash ('/').
81 Note that multiplication has a higher precedence than division,
82 so 'm/s/s' is the same as 'm/s^2' or 'm/s s'.
83 Division of numbers
84 must be indicated using the vertical bar ('|').
85 To convert half a
86 meter, you would write '1|2 meter'.
87 If you write '1/2 meter' then the
88 units program would interpret that as equivalent to '0.5/meter'.
89 If you enter incompatible unit types, the units program will
90 print a message indicating that the units are not conformable and
91 it will display the reduced form for each unit:
92 .Bd -literal
93     You have: ergs/hour
94     You want: fathoms kg^2 / day
95     conformability error
96             2.7777778e-11 kg m^2 / sec^3
97             2.1166667e-05 kg^2 m / sec
98 .Ed
99 .Pp
100 The conversion information is read from a units data file.
101 The default
102 file includes definitions for most familiar units, abbreviations and
103 metric prefixes.
104 Some constants of nature included are:
105 .Pp
106 .Bl -column -offset indent -compact "mercury"
107 .It "pi ratio of circumference to diameter"
108 .It "c  speed of light"
109 .It "e  charge on an electron"
110 .It "g  acceleration of gravity"
111 .It "force      same as g"
112 .It "mole       Avogadro's number"
113 .It "water      pressure per unit height of water"
114 .It "mercury    pressure per unit height of mercury"
115 .It "au astronomical unit"
116 .El
117 .Pp
118 The unit 'pound' is a unit of mass.
119 Compound names are run together
120 so 'pound force' is a unit of force.
121 The unit 'ounce' is also a unit
122 of mass.
123 The fluid ounce is 'floz'.
124 British units that differ from
125 their US counterparts are prefixed with 'br', and currency is prefixed
126 with its country name: 'belgiumfranc', 'britainpound'.
127 When searching
128 for a unit, if the specified string does not appear exactly as a unit
129 name, then
130 .Nm
131 will try to remove a trailing 's' or a
132 trailing 'es' and check again for a match.
133 .Pp
134 To find out what units are available read the standard units file.
135 If you want to add your own units you can supply your own file.
136 A unit is specified on a single line by
137 giving its name and an equivalence.
138 Be careful to define
139 new units in terms of old ones so that a reduction leads to the
140 primitive units which are marked with '!' characters.
141 The
142 .Nm
143 program will not detect infinite loops that could be caused
144 by careless unit definitions.
145 Comments in the unit definition file
146 begin with a '/' character at the beginning of a line.
147 .Pp
148 Prefixes are defined in the same was as standard units, but with
149 a trailing dash at the end of the prefix name.
150 If a unit is not found
151 even after removing trailing 's' or 'es', then it will be checked
152 against the list of prefixes.
153 Prefixes will be removed until a legal
154 base unit is identified.
155 .Pp
156 Here is an example of a short units file that defines some basic
157 units.
158 .Pp
159 .Bl -column -offset indent -compact "minute"
160 .It "m  !a!"
161 .It "sec        !b!"
162 .It "micro-     1e-6"
163 .It "minute     60 sec"
164 .It "hour       60 min"
165 .It "inch       0.0254 m"
166 .It "ft 12 inches"
167 .It "mile       5280 ft"
168 .El
169 .Sh FILES
170 .Bl -tag -width /usr/share/misc/units.lib -compact
171 .It Pa /usr/share/misc/units.lib
172 the standard units library
173 .El
174 .Sh AUTHORS
175 .An Adrian Mariano Aq Mt adrian@cam.cornell.edu
176 .Sh BUGS
177 The effect of including a '/' in a prefix is surprising.
178 .Pp
179 Exponents entered by the user can be only one digit.
180 You can work around this by multiplying several terms.
181 .Pp
182 The user must use | to indicate division of numbers and / to
183 indicate division of symbols.
184 This distinction should not
185 be necessary.
186 .Pp
187 The program contains various arbitrary limits on the length
188 of the units converted and on the length of the data file.
189 .Pp
190 The program should use a hash table to store units so that
191 it does not take so long to load the units list and check
192 for duplication.