/usr/share/doc/liblzma-doc/html/suffix_8c.html is in liblzma-doc 5.1.1alpha+20120614-2ubuntu2.
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 | <!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"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>XZ Utils: xz/suffix.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.6 -->
<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="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">suffix.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Checks filename suffix and creates the destination filename.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include "<a class="el" href="private_8h.html">private.h</a>"</code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:abdcb889ff949d18ed88c930ed061db44"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#abdcb889ff949d18ed88c930ed061db44">is_dir_sep</a> (char c)</td></tr>
<tr class="memdesc:abdcb889ff949d18ed88c930ed061db44"><td class="mdescLeft"> </td><td class="mdescRight">Test if the char is a directory separator. <a href="#abdcb889ff949d18ed88c930ed061db44">More...</a><br/></td></tr>
<tr class="separator:abdcb889ff949d18ed88c930ed061db44"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aac192477468016c425e6a0057d38203a"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#aac192477468016c425e6a0057d38203a">has_dir_sep</a> (const char *str)</td></tr>
<tr class="memdesc:aac192477468016c425e6a0057d38203a"><td class="mdescLeft"> </td><td class="mdescRight">Test if the string contains a directory separator. <a href="#aac192477468016c425e6a0057d38203a">More...</a><br/></td></tr>
<tr class="separator:aac192477468016c425e6a0057d38203a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abb61f16b0f6970c0d18aee7d9f778f34"><td class="memItemLeft" align="right" valign="top">static size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#abb61f16b0f6970c0d18aee7d9f778f34">test_suffix</a> (const char *suffix, const char *src_name, size_t src_len)</td></tr>
<tr class="memdesc:abb61f16b0f6970c0d18aee7d9f778f34"><td class="mdescLeft"> </td><td class="mdescRight">Checks if src_name has given compressed_suffix. <a href="#abb61f16b0f6970c0d18aee7d9f778f34">More...</a><br/></td></tr>
<tr class="separator:abb61f16b0f6970c0d18aee7d9f778f34"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad079d499b2fe1cdbba345998711a8fc0"><td class="memItemLeft" align="right" valign="top">static char * </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#ad079d499b2fe1cdbba345998711a8fc0">uncompressed_name</a> (const char *src_name, const size_t src_len)</td></tr>
<tr class="memdesc:ad079d499b2fe1cdbba345998711a8fc0"><td class="mdescLeft"> </td><td class="mdescRight">Removes the filename suffix of the compressed file. <a href="#ad079d499b2fe1cdbba345998711a8fc0">More...</a><br/></td></tr>
<tr class="separator:ad079d499b2fe1cdbba345998711a8fc0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aab6429343a51adabf1c9b62aa1cf7b50"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#aab6429343a51adabf1c9b62aa1cf7b50">msg_suffix</a> (const char *src_name, const char *suffix)</td></tr>
<tr class="separator:aab6429343a51adabf1c9b62aa1cf7b50"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2ad0f107f38f2223f3f797e0f11a47a5"><td class="memItemLeft" align="right" valign="top">static char * </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5">compressed_name</a> (const char *src_name, size_t src_len)</td></tr>
<tr class="memdesc:a2ad0f107f38f2223f3f797e0f11a47a5"><td class="mdescLeft"> </td><td class="mdescRight">Appends suffix to src_name. <a href="#a2ad0f107f38f2223f3f797e0f11a47a5">More...</a><br/></td></tr>
<tr class="separator:a2ad0f107f38f2223f3f797e0f11a47a5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abdb170ea5ed537b62854a65c3e5d5b89"><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#abdb170ea5ed537b62854a65c3e5d5b89">suffix_get_dest_name</a> (const char *src_name)</td></tr>
<tr class="memdesc:abdb170ea5ed537b62854a65c3e5d5b89"><td class="mdescLeft"> </td><td class="mdescRight">Get the name of the destination file. <a href="#abdb170ea5ed537b62854a65c3e5d5b89">More...</a><br/></td></tr>
<tr class="separator:abdb170ea5ed537b62854a65c3e5d5b89"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a73ac0221028e731bba6ce634da639ab2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="suffix_8c.html#a73ac0221028e731bba6ce634da639ab2">suffix_set</a> (const char *suffix)</td></tr>
<tr class="memdesc:a73ac0221028e731bba6ce634da639ab2"><td class="mdescLeft"> </td><td class="mdescRight">Set a custom filename suffix. <a href="#a73ac0221028e731bba6ce634da639ab2">More...</a><br/></td></tr>
<tr class="separator:a73ac0221028e731bba6ce634da639ab2"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a3660fe30983959154dc91ab8a78c74ab"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3660fe30983959154dc91ab8a78c74ab"></a>
static char * </td><td class="memItemRight" valign="bottom"><b>custom_suffix</b> = NULL</td></tr>
<tr class="separator:a3660fe30983959154dc91ab8a78c74ab"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Checks filename suffix and creates the destination filename. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="abdcb889ff949d18ed88c930ed061db44"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static bool is_dir_sep </td>
<td>(</td>
<td class="paramtype">char </td>
<td class="paramname"><em>c</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>Test if the char is a directory separator. </p>
<p>Referenced by <a class="el" href="suffix_8c.html#abb61f16b0f6970c0d18aee7d9f778f34">test_suffix()</a>.</p>
</div>
</div>
<a class="anchor" id="aac192477468016c425e6a0057d38203a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static bool has_dir_sep </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>str</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>Test if the string contains a directory separator. </p>
<p>Referenced by <a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5">compressed_name()</a>, and <a class="el" href="suffix_8h.html#a73ac0221028e731bba6ce634da639ab2">suffix_set()</a>.</p>
</div>
</div>
<a class="anchor" id="abb61f16b0f6970c0d18aee7d9f778f34"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static size_t test_suffix </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>suffix</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>src_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</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>Checks if src_name has given compressed_suffix. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">suffix</td><td>Filename suffix to look for </td></tr>
<tr><td class="paramname">src_name</td><td>Input filename </td></tr>
<tr><td class="paramname">src_len</td><td>strlen(src_name)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If src_name has the suffix, src_len - strlen(suffix) is returned. It's always a positive integer. Otherwise zero is returned. </dd></dl>
<p>References <a class="el" href="suffix_8c.html#abdcb889ff949d18ed88c930ed061db44">is_dir_sep()</a>.</p>
<p>Referenced by <a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5">compressed_name()</a>, and <a class="el" href="suffix_8c.html#ad079d499b2fe1cdbba345998711a8fc0">uncompressed_name()</a>.</p>
</div>
</div>
<a class="anchor" id="ad079d499b2fe1cdbba345998711a8fc0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static char* uncompressed_name </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const size_t </td>
<td class="paramname"><em>src_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</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>Removes the filename suffix of the compressed file. </p>
<dl class="section return"><dt>Returns</dt><dd>Name of the uncompressed file, or NULL if file has unknown suffix. </dd></dl>
<p>References <a class="el" href="message_8h.html#a61c64c39e7ec889482a901fbd63f794c">message_error()</a>, <a class="el" href="message_8h.html#a7b1aa271362d38242ea6c42e3d5453aa">message_warning()</a>, <a class="el" href="coder_8c.html#a86110016dfb55682abf8a2b25927c3fc">opt_format</a>, <a class="el" href="suffix_8c.html#abb61f16b0f6970c0d18aee7d9f778f34">test_suffix()</a>, and <a class="el" href="util_8h.html#add65fdb55fc7500c5443d169143f31a7">xmalloc</a>.</p>
<p>Referenced by <a class="el" href="suffix_8h.html#abdb170ea5ed537b62854a65c3e5d5b89">suffix_get_dest_name()</a>.</p>
</div>
</div>
<a class="anchor" id="aab6429343a51adabf1c9b62aa1cf7b50"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void msg_suffix </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>suffix</em> </td>
</tr>
<tr>
<td></td>
<td>)</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>This message is needed in multiple places in <a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5" title="Appends suffix to src_name. ">compressed_name()</a>, so the message has been put into its own function. </p>
<p>References <a class="el" href="message_8h.html#a7b1aa271362d38242ea6c42e3d5453aa">message_warning()</a>.</p>
<p>Referenced by <a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5">compressed_name()</a>.</p>
</div>
</div>
<a class="anchor" id="a2ad0f107f38f2223f3f797e0f11a47a5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static char* compressed_name </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>src_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</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>Appends suffix to src_name. </p>
<p>In contrast to <a class="el" href="suffix_8c.html#ad079d499b2fe1cdbba345998711a8fc0" title="Removes the filename suffix of the compressed file. ">uncompressed_name()</a>, we check only suffixes that are valid for the specified file format. </p>
<p>References <a class="el" href="suffix_8c.html#aac192477468016c425e6a0057d38203a">has_dir_sep()</a>, <a class="el" href="message_8h.html#a61c64c39e7ec889482a901fbd63f794c">message_error()</a>, <a class="el" href="suffix_8c.html#aab6429343a51adabf1c9b62aa1cf7b50">msg_suffix()</a>, <a class="el" href="coder_8c.html#a86110016dfb55682abf8a2b25927c3fc">opt_format</a>, <a class="el" href="suffix_8c.html#abb61f16b0f6970c0d18aee7d9f778f34">test_suffix()</a>, and <a class="el" href="util_8h.html#add65fdb55fc7500c5443d169143f31a7">xmalloc</a>.</p>
<p>Referenced by <a class="el" href="suffix_8h.html#abdb170ea5ed537b62854a65c3e5d5b89">suffix_get_dest_name()</a>.</p>
</div>
</div>
<a class="anchor" id="abdb170ea5ed537b62854a65c3e5d5b89"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* suffix_get_dest_name </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>src_name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the name of the destination file. </p>
<p>Depending on the global variable opt_mode, this tries to find a matching counterpart for src_name. If the name can be constructed, it is allocated and returned (caller must free it). On error, a message is printed and NULL is returned. </p>
<p>References <a class="el" href="suffix_8c.html#a2ad0f107f38f2223f3f797e0f11a47a5">compressed_name()</a>, <a class="el" href="coder_8c.html#aed58b2945b6b414405af58615ca823b6">opt_mode</a>, and <a class="el" href="suffix_8c.html#ad079d499b2fe1cdbba345998711a8fc0">uncompressed_name()</a>.</p>
</div>
</div>
<a class="anchor" id="a73ac0221028e731bba6ce634da639ab2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void suffix_set </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>suffix</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set a custom filename suffix. </p>
<p>This function calls <a class="el" href="util_8c.html#a401dd8b99774c03e2dafe25f57d259e8" title="Safe strdup() that never returns NULL. ">xstrdup()</a> for the given suffix, thus the caller doesn't need to keep the memory allocated. There can be only one custom suffix, thus if this is called multiple times, the old suffixes are freed and forgotten. </p>
<p>References <a class="el" href="suffix_8c.html#aac192477468016c425e6a0057d38203a">has_dir_sep()</a>, <a class="el" href="message_8h.html#aff3f122bb031385c3969689f471800eb">message_fatal()</a>, and <a class="el" href="util_8c.html#a401dd8b99774c03e2dafe25f57d259e8">xstrdup()</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Feb 12 2014 15:12:37 for XZ Utils by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
|