This commit is contained in:
sylvestre
2023-04-29 02:34:49 +00:00
parent e2e3c0d506
commit eb131ff823
15 changed files with 43 additions and 23 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -12,7 +12,7 @@ var searchIndex = JSON.parse('{\
"chroot":{"doc":"","t":"F","n":["main"],"q":["chroot"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
"cksum":{"doc":"","t":"F","n":["main"],"q":["cksum"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
"comm":{"doc":"","t":"F","n":["main"],"q":["comm"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
"coreutils":{"doc":"","t":"GRFFFFFFFFF","n":["UtilityMap","VERSION","binary_path","gen_completions","gen_coreutils_app","gen_manpage","main","name","not_found","usage","util_map"],"q":["coreutils","","","","","","","","","",""],"d":["","","","Prints completions for the utility in the first parameter …","","Generate the manpage for the utility in the first parameter","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0],"f":[0,0,[[],1],[[2,3],4],[3,5],[[2,3],4],[[]],[6,7],[8,4],[[3,7]],[[],[[3,[7]]]]],"p":[[3,"PathBuf"],[8,"Iterator"],[3,"Map"],[15,"never"],[3,"Command"],[3,"Path"],[15,"str"],[3,"OsStr"]]},\
"coreutils":{"doc":"","t":"GRFFFFFFFFF","n":["UtilityMap","VERSION","binary_path","gen_completions","gen_coreutils_app","gen_manpage","main","name","not_found","usage","util_map"],"q":["coreutils","","","","","","","","","",""],"d":["","","","Prints completions for the utility in the first parameter …","","Generate the manpage for the utility in the first parameter","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0],"f":[0,0,[[],1],[[2,3],4],[3,5],[[2,3],4],[[]],[6,[[8,[7]]]],[9,4],[[3,7]],[[],[[3,[7]]]]],"p":[[3,"PathBuf"],[8,"Iterator"],[3,"Map"],[15,"never"],[3,"Command"],[3,"Path"],[15,"str"],[4,"Option"],[3,"OsStr"]]},\
"cp":{"doc":"","t":"F","n":["main"],"q":["cp"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
"csplit":{"doc":"","t":"F","n":["main"],"q":["csplit"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
"cut":{"doc":"","t":"F","n":["main"],"q":["cut"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\
+9 -3
View File
@@ -213,6 +213,9 @@
<a href="#213" id="213">213</a>
<a href="#214" id="214">214</a>
<a href="#215" id="215">215</a>
<a href="#216" id="216">216</a>
<a href="#217" id="217">217</a>
<a href="#218" id="218">218</a>
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
//
// (c) Michael Gehring &lt;mg@ebfe.org&gt;
@@ -258,8 +261,8 @@
}
}
<span class="kw">fn </span>name(binary_path: <span class="kw-2">&amp;</span>Path) -&gt; <span class="kw-2">&amp;</span>str {
binary_path.file_stem().unwrap().to_str().unwrap()
<span class="kw">fn </span>name(binary_path: <span class="kw-2">&amp;</span>Path) -&gt; <span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;</span>str&gt; {
binary_path.file_stem()<span class="question-mark">?</span>.to_str()
}
<span class="kw">fn </span>main() {
@@ -269,7 +272,10 @@
<span class="kw">let </span><span class="kw-2">mut </span>args = uucore::args_os();
<span class="kw">let </span>binary = binary_path(<span class="kw-2">&amp;mut </span>args);
<span class="kw">let </span>binary_as_util = name(<span class="kw-2">&amp;</span>binary);
<span class="kw">let </span>binary_as_util = name(<span class="kw-2">&amp;</span>binary).unwrap_or_else(|| {
usage(<span class="kw-2">&amp;</span>utils, <span class="string">&quot;&lt;unknown binary name&gt;&quot;</span>);
process::exit(<span class="number">0</span>);
});
<span class="comment">// binary name equals util name?
</span><span class="kw">if let </span><span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>(uumain, <span class="kw">_</span>)) = utils.get(binary_as_util) {
+19 -3
View File
@@ -229,6 +229,14 @@
<a href="#229" id="229">229</a>
<a href="#230" id="230">230</a>
<a href="#231" id="231">231</a>
<a href="#232" id="232">232</a>
<a href="#233" id="233">233</a>
<a href="#234" id="234">234</a>
<a href="#235" id="235">235</a>
<a href="#236" id="236">236</a>
<a href="#237" id="237">237</a>
<a href="#238" id="238">238</a>
<a href="#239" id="239">239</a>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon &lt;arcterus@mail.com&gt;
@@ -243,7 +251,7 @@
<span class="kw">use </span>std::fs::File;
<span class="kw">use </span>std::io::{stdin, stdout, BufRead, BufReader, Read, Write};
<span class="kw">use </span>std::path::Path;
<span class="kw">use </span>uucore::error::{FromIo, UResult};
<span class="kw">use </span>uucore::error::{FromIo, UResult, USimpleError};
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage};
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;paste.md&quot;</span>);
@@ -360,6 +368,16 @@
files.push(file);
}
<span class="kw">if </span>delimiters.ends_with(<span class="string">&#39;\\&#39;</span>) &amp;&amp; !delimiters.ends_with(<span class="string">&quot;\\\\&quot;</span>) {
<span class="kw">return </span><span class="prelude-val">Err</span>(USimpleError::new(
<span class="number">1</span>,
<span class="macro">format!</span>(
<span class="string">&quot;delimiter list ends with an unescaped backslash: {}&quot;</span>,
delimiters
),
));
}
<span class="kw">let </span>delimiters: Vec&lt;char&gt; = unescape(delimiters).chars().collect();
<span class="kw">let </span><span class="kw-2">mut </span>delim_count = <span class="number">0</span>;
<span class="kw">let </span><span class="kw-2">mut </span>delim_length = <span class="number">1</span>;
@@ -453,12 +471,10 @@
}
<span class="comment">// Unescape all special characters
// TODO: this will need work to conform to GNU implementation
</span><span class="kw">fn </span>unescape(s: <span class="kw-2">&amp;</span>str) -&gt; String {
s.replace(<span class="string">&quot;\\n&quot;</span>, <span class="string">&quot;\n&quot;</span>)
.replace(<span class="string">&quot;\\t&quot;</span>, <span class="string">&quot;\t&quot;</span>)
.replace(<span class="string">&quot;\\\\&quot;</span>, <span class="string">&quot;\\&quot;</span>)
.replace(<span class="string">&#39;\\&#39;</span>, <span class="string">&quot;&quot;</span>)
}
</code></pre></div>
</section></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="uu_paste" data-themes="" data-resource-suffix="" data-rustdoc-version="1.69.0 (84c898d65 2023-04-16)" data-search-js="search-8a59a8356673ec1f.js" data-settings-js="settings-f0c5c39777a9a2f6.js" data-settings-css="settings-0bcba95ff279c1db.css" ></div></body></html>
+3 -5
View File
@@ -167,7 +167,6 @@
<a href="#167" id="167">167</a>
<a href="#168" id="168">168</a>
<a href="#169" id="169">169</a>
<a href="#170" id="170">170</a>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) T. Jameson Little &lt;t.jameson.little@gmail.com&gt;
@@ -183,11 +182,10 @@
<span class="kw">use </span>std::path::Path;
<span class="kw">use </span>uucore::display::Quotable;
<span class="kw">use </span>uucore::error::{FromIo, UResult, USimpleError};
<span class="kw">use </span>uucore::{format_usage, show};
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage, show};
<span class="kw">static </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="string">&quot;{} [OPTION]... [FILE]...&quot;</span>;
<span class="kw">static </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="string">&quot;Checksum and count the blocks in a file.\n\n\
With no FILE, or when FILE is -, read standard input.&quot;</span>;
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;sum.md&quot;</span>);
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;sum.md&quot;</span>);
<span class="comment">// This can be replaced with usize::div_ceil once it is stabilized.
// This implementation approach is optimized for when `b` is a constant,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long