/usr/share/doc/liblzma-doc/html/util_8c.html is in liblzma-doc 5.1.1alpha+20120614-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>XZ Utils: xz/util.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">XZ Utils
 <span id="projectnumber">5.1.0alpha</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_53e01eec41348db90f08d9ee7e6793af.html">xz</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">util.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Miscellaneous utility functions.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include "<a class="el" href="private_8h.html">private.h</a>"</code><br/>
<code>#include <stdarg.h></code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:aabfcbcb5ac86a1edac4035264bc7d2b8"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom">{ <b>UNKNOWN</b>,
<b>WORKS</b>,
<b>BROKEN</b>
}</td></tr>
<tr class="memdesc:aabfcbcb5ac86a1edac4035264bc7d2b8"><td class="mdescLeft"> </td><td class="mdescRight">Thousand separator support in <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> <a href="util_8c.html#aabfcbcb5ac86a1edac4035264bc7d2b8">More...</a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a93a8ec6e8a6eef0f62b7e5b50d0bf9e4"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a93a8ec6e8a6eef0f62b7e5b50d0bf9e4">xrealloc</a> (void *ptr, size_t size)</td></tr>
<tr class="memdesc:a93a8ec6e8a6eef0f62b7e5b50d0bf9e4"><td class="mdescLeft"> </td><td class="mdescRight">Safe realloc() that never returns NULL. <a href="#a93a8ec6e8a6eef0f62b7e5b50d0bf9e4"></a><br/></td></tr>
<tr class="memitem:a401dd8b99774c03e2dafe25f57d259e8"><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a401dd8b99774c03e2dafe25f57d259e8">xstrdup</a> (const char *src)</td></tr>
<tr class="memdesc:a401dd8b99774c03e2dafe25f57d259e8"><td class="mdescLeft"> </td><td class="mdescRight">Safe strdup() that never returns NULL. <a href="#a401dd8b99774c03e2dafe25f57d259e8"></a><br/></td></tr>
<tr class="memitem:a0ec7e8d80d1eb63f7ea31dd8e0bb56a2"><td class="memItemLeft" align="right" valign="top">uint64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a0ec7e8d80d1eb63f7ea31dd8e0bb56a2">str_to_uint64</a> (const char *name, const char *value, uint64_t min, uint64_t max)</td></tr>
<tr class="memdesc:a0ec7e8d80d1eb63f7ea31dd8e0bb56a2"><td class="mdescLeft"> </td><td class="mdescRight">Fancy version of strtoull() <a href="#a0ec7e8d80d1eb63f7ea31dd8e0bb56a2"></a><br/></td></tr>
<tr class="memitem:aecb8fdaf99a830f7fe8697ca87f8acea"><td class="memItemLeft" align="right" valign="top">uint64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#aecb8fdaf99a830f7fe8697ca87f8acea">round_up_to_mib</a> (uint64_t n)</td></tr>
<tr class="memdesc:aecb8fdaf99a830f7fe8697ca87f8acea"><td class="mdescLeft"> </td><td class="mdescRight">Round an integer up to the next full MiB and convert to MiB. <a href="#aecb8fdaf99a830f7fe8697ca87f8acea"></a><br/></td></tr>
<tr class="memitem:af5eb4752db416065fb840d745152a0af"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#af5eb4752db416065fb840d745152a0af">check_thousand_sep</a> (uint32_t slot)</td></tr>
<tr class="memitem:a157dec70513354b09a89166c74ddac53"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53">uint64_to_str</a> (uint64_t value, uint32_t slot)</td></tr>
<tr class="memdesc:a157dec70513354b09a89166c74ddac53"><td class="mdescLeft"> </td><td class="mdescRight">Convert uint64_t to a string. <a href="#a157dec70513354b09a89166c74ddac53"></a><br/></td></tr>
<tr class="memitem:a459cbc5237b7dbb1b68cd6cd605c8af2"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2">uint64_to_nicestr</a> (uint64_t value, enum nicestr_unit unit_min, enum nicestr_unit unit_max, bool always_also_bytes, uint32_t slot)</td></tr>
<tr class="memdesc:a459cbc5237b7dbb1b68cd6cd605c8af2"><td class="mdescLeft"> </td><td class="mdescRight">Convert uint64_t to a nice human readable string. <a href="#a459cbc5237b7dbb1b68cd6cd605c8af2"></a><br/></td></tr>
<tr class="memitem:adf7ceb964e309753ed9049f40fce3e81"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf7ceb964e309753ed9049f40fce3e81"></a>
void </td><td class="memItemRight" valign="bottom"><b>my_snprintf</b> (char **pos, size_t *left, const char *fmt,...)</td></tr>
<tr class="memitem:a365345158771d9f70b1487c23149af53"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a365345158771d9f70b1487c23149af53">is_empty_filename</a> (const char *<a class="el" href="message_8c.html#a7efa5e9c7494c7d4586359300221aa5d">filename</a>)</td></tr>
<tr class="memdesc:a365345158771d9f70b1487c23149af53"><td class="mdescLeft"> </td><td class="mdescRight">Check if filename is empty and print an error message. <a href="#a365345158771d9f70b1487c23149af53"></a><br/></td></tr>
<tr class="memitem:a2e66a584038626fa52f42665f7a852ba"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a2e66a584038626fa52f42665f7a852ba">is_tty_stdin</a> (void)</td></tr>
<tr class="memdesc:a2e66a584038626fa52f42665f7a852ba"><td class="mdescLeft"> </td><td class="mdescRight">Test if stdin is a terminal. <a href="#a2e66a584038626fa52f42665f7a852ba"></a><br/></td></tr>
<tr class="memitem:ad2b365a28363f4feb2bde1196f79c5dc"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#ad2b365a28363f4feb2bde1196f79c5dc">is_tty_stdout</a> (void)</td></tr>
<tr class="memdesc:ad2b365a28363f4feb2bde1196f79c5dc"><td class="mdescLeft"> </td><td class="mdescRight">Test if stdout is a terminal. <a href="#ad2b365a28363f4feb2bde1196f79c5dc"></a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:af3356c8f2c1789480bf47cbfec2c9a0b"><td class="memItemLeft" align="right" valign="top">static char </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#af3356c8f2c1789480bf47cbfec2c9a0b">bufs</a> [4][128]</td></tr>
<tr class="memdesc:af3356c8f2c1789480bf47cbfec2c9a0b"><td class="mdescLeft"> </td><td class="mdescRight">Buffers for <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> <a href="#af3356c8f2c1789480bf47cbfec2c9a0b"></a><br/></td></tr>
<tr class="memitem:a4eab79c6aaf33f7330ee3e5dbd47334b"><td class="memItemLeft" align="right" valign="top">static enum { ... }  </td><td class="memItemRight" valign="bottom"><a class="el" href="util_8c.html#a4eab79c6aaf33f7330ee3e5dbd47334b">thousand</a></td></tr>
<tr class="memdesc:a4eab79c6aaf33f7330ee3e5dbd47334b"><td class="mdescLeft"> </td><td class="mdescRight">Thousand separator support in <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> <a href="#a4eab79c6aaf33f7330ee3e5dbd47334b"></a><br/></td></tr>
</table>
<a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Miscellaneous utility functions. </p>
</div><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="aabfcbcb5ac86a1edac4035264bc7d2b8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">anonymous enum</td>
</tr>
</table>
</div><div class="memdoc">
<p>Thousand separator support in <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> </p>
</div>
</div>
<h2>Function Documentation</h2>
<a class="anchor" id="a93a8ec6e8a6eef0f62b7e5b50d0bf9e4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* xrealloc </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Safe realloc() that never returns NULL. </p>
<p>References <a class="el" href="message_8h.html#aff3f122bb031385c3969689f471800eb">message_fatal()</a>.</p>
</div>
</div>
<a class="anchor" id="a401dd8b99774c03e2dafe25f57d259e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* xstrdup </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Safe strdup() that never returns NULL. </p>
<p>References <a class="el" href="util_8h.html#add65fdb55fc7500c5443d169143f31a7">xmalloc</a>.</p>
<p>Referenced by <a class="el" href="options_8c.html#a2e874128ae1211846d8be167e3ef4a7b">parse_options()</a>, and <a class="el" href="suffix_8h.html#a73ac0221028e731bba6ce634da639ab2">suffix_set()</a>.</p>
</div>
</div>
<a class="anchor" id="a0ec7e8d80d1eb63f7ea31dd8e0bb56a2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t str_to_uint64 </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>min</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>max</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Fancy version of strtoull() </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">name</td><td>Name of the option to show in case of an error </td></tr>
<tr><td class="paramname">value</td><td>String containing the number to be parsed; may contain suffixes "k", "M", "G", "Ki", "Mi", or "Gi" </td></tr>
<tr><td class="paramname">min</td><td>Minimum valid value </td></tr>
<tr><td class="paramname">max</td><td>Maximum valid value</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Parsed value that is in the range [min, max]. Does not return if an error occurs. </dd></dl>
<p>References <a class="el" href="message_8h.html#a959623d4d066ba4c9d0265c16928149e">message()</a>, <a class="el" href="message_8h.html#aff3f122bb031385c3969689f471800eb">message_fatal()</a>, and <a class="el" href="message_8h.html#a36bc083ed62e2e0fdcda60f1c2e1153daa96a214a1aaf8f85440099c58309bb9e">V_ERROR</a>.</p>
<p>Referenced by <a class="el" href="args_8c.html#a1a3fb962627ec1e052317c46a8b351ff">parse_memlimit()</a>, and <a class="el" href="options_8c.html#a2e874128ae1211846d8be167e3ef4a7b">parse_options()</a>.</p>
</div>
</div>
<a class="anchor" id="aecb8fdaf99a830f7fe8697ca87f8acea"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t round_up_to_mib </td>
<td>(</td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>n</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Round an integer up to the next full MiB and convert to MiB. </p>
<p>This is used when printing memory usage and limit. </p>
<p>Referenced by <a class="el" href="hardware_8c.html#ad56580adea56000e543fb4cda80fc003">memlimit_show()</a>, and <a class="el" href="message_8h.html#a6953ba5a13ff12f32091346b5772e992">message_mem_needed()</a>.</p>
</div>
</div>
<a class="anchor" id="af5eb4752db416065fb840d745152a0af"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void check_thousand_sep </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>slot</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Check if thousand separator is supported. Run-time checking is easiest, because it seems to be sometimes lacking even on POSIXish system. </p>
<p>References <a class="el" href="util_8c.html#af3356c8f2c1789480bf47cbfec2c9a0b">bufs</a>, and <a class="el" href="util_8c.html#a4eab79c6aaf33f7330ee3e5dbd47334b">thousand</a>.</p>
<p>Referenced by <a class="el" href="util_8h.html#a459cbc5237b7dbb1b68cd6cd605c8af2">uint64_to_nicestr()</a>, and <a class="el" href="util_8h.html#a157dec70513354b09a89166c74ddac53">uint64_to_str()</a>.</p>
</div>
</div>
<a class="anchor" id="a157dec70513354b09a89166c74ddac53"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* uint64_to_str </td>
<td>(</td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>slot</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Convert uint64_t to a string. </p>
<p>Convert the given value to a string with locale-specific thousand separators, if supported by the snprintf() implementation. The string is stored into an internal static buffer indicated by the slot argument. A pointer to the selected buffer is returned.</p>
<p>This function exists, because non-POSIX systems don't support thousand separator in format strings. Solving the problem in a simple way doesn't work, because it breaks gettext (specifically, the xgettext tool). </p>
<p>References <a class="el" href="util_8c.html#af3356c8f2c1789480bf47cbfec2c9a0b">bufs</a>, <a class="el" href="util_8c.html#af5eb4752db416065fb840d745152a0af">check_thousand_sep()</a>, and <a class="el" href="util_8c.html#a4eab79c6aaf33f7330ee3e5dbd47334b">thousand</a>.</p>
<p>Referenced by <a class="el" href="hardware_8c.html#ad56580adea56000e543fb4cda80fc003">memlimit_show()</a>, and <a class="el" href="message_8h.html#a6953ba5a13ff12f32091346b5772e992">message_mem_needed()</a>.</p>
</div>
</div>
<a class="anchor" id="a459cbc5237b7dbb1b68cd6cd605c8af2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* uint64_to_nicestr </td>
<td>(</td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">enum nicestr_unit </td>
<td class="paramname"><em>unit_min</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">enum nicestr_unit </td>
<td class="paramname"><em>unit_max</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>always_also_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>slot</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Convert uint64_t to a nice human readable string. </p>
<p>This is like <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> but uses B, KiB, MiB, GiB, or TiB suffix and optionally includes the exact size in parenthesis.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">value</td><td>Value to be printed </td></tr>
<tr><td class="paramname">unit_min</td><td>Smallest unit to use. This and unit_max are used e.g. when showing the progress indicator to force the unit to MiB. </td></tr>
<tr><td class="paramname">unit_max</td><td>Biggest unit to use. assert(unit_min <= unit_max). </td></tr>
<tr><td class="paramname">always_also_bytes</td><td>Show also the exact byte value in parenthesis if the nicely formatted string uses bigger unit than bytes. </td></tr>
<tr><td class="paramname">slot</td><td>Which static buffer to use to hold the string. This is shared with <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to statically allocated buffer containing the string.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This uses double_to_str() internally so the static buffer in double_to_str() will be overwritten. </dd></dl>
<p>References <a class="el" href="util_8c.html#af3356c8f2c1789480bf47cbfec2c9a0b">bufs</a>, <a class="el" href="util_8c.html#af5eb4752db416065fb840d745152a0af">check_thousand_sep()</a>, <a class="el" href="util_8h.html#a935bb9522106de53d1e6573a0289843c">my_snprintf()</a>, and <a class="el" href="util_8c.html#a4eab79c6aaf33f7330ee3e5dbd47334b">thousand</a>.</p>
<p>Referenced by <a class="el" href="message_8c.html#a59105b134b42b8d500422f64423c5f52">progress_sizes()</a>.</p>
</div>
</div>
<a class="anchor" id="a365345158771d9f70b1487c23149af53"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool is_empty_filename </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>filename</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check if filename is empty and print an error message. </p>
<p>References <a class="el" href="message_8h.html#a61c64c39e7ec889482a901fbd63f794c">message_error()</a>.</p>
<p>Referenced by <a class="el" href="file__io_8h.html#ac4fb03f340ee03676cbde913682a3719">io_open_src()</a>.</p>
</div>
</div>
<a class="anchor" id="a2e66a584038626fa52f42665f7a852ba"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool is_tty_stdin </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test if stdin is a terminal. </p>
<p>If stdin is a terminal, an error message is printed and exit status set to EXIT_ERROR. </p>
<p>References <a class="el" href="message_8h.html#a61c64c39e7ec889482a901fbd63f794c">message_error()</a>.</p>
</div>
</div>
<a class="anchor" id="ad2b365a28363f4feb2bde1196f79c5dc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool is_tty_stdout </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Test if stdout is a terminal. </p>
<p>If stdout is a terminal, an error message is printed and exit status set to EXIT_ERROR. </p>
<p>References <a class="el" href="message_8h.html#a61c64c39e7ec889482a901fbd63f794c">message_error()</a>.</p>
</div>
</div>
<h2>Variable Documentation</h2>
<a class="anchor" id="af3356c8f2c1789480bf47cbfec2c9a0b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">char bufs[4][128]</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Buffers for <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> </p>
<p>Referenced by <a class="el" href="util_8c.html#af5eb4752db416065fb840d745152a0af">check_thousand_sep()</a>, <a class="el" href="util_8h.html#a459cbc5237b7dbb1b68cd6cd605c8af2">uint64_to_nicestr()</a>, and <a class="el" href="util_8h.html#a157dec70513354b09a89166c74ddac53">uint64_to_str()</a>.</p>
</div>
</div>
<a class="anchor" id="a4eab79c6aaf33f7330ee3e5dbd47334b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum { ... } thousand</td>
</tr>
</table>
</div><div class="memdoc">
<p>Thousand separator support in <a class="el" href="util_8c.html#a157dec70513354b09a89166c74ddac53" title="Convert uint64_t to a string.">uint64_to_str()</a> and <a class="el" href="util_8c.html#a459cbc5237b7dbb1b68cd6cd605c8af2" title="Convert uint64_t to a nice human readable string.">uint64_to_nicestr()</a> </p>
<p>Referenced by <a class="el" href="util_8c.html#af5eb4752db416065fb840d745152a0af">check_thousand_sep()</a>, <a class="el" href="util_8h.html#a459cbc5237b7dbb1b68cd6cd605c8af2">uint64_to_nicestr()</a>, and <a class="el" href="util_8h.html#a157dec70513354b09a89166c74ddac53">uint64_to_str()</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Nov 18 2012 19:30:21 for XZ Utils by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>
|