mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Unescape all special characters in delimiter list.
This commit is contained in:
parent
773eeb6d5e
commit
b00a49eab2
1 changed files with 12 additions and 1 deletions
|
@ -67,8 +67,10 @@ fn paste(filenames: Vec<String>, serial: bool, delimiters: String) {
|
|||
}
|
||||
)
|
||||
).collect();
|
||||
let delimiters: Vec<String> = delimiters.chars().map(|x| x.to_string()).collect();
|
||||
|
||||
let delimiters: Vec<String> = unescape(delimiters).chars().map(|x| x.to_string()).collect();
|
||||
let mut delim_count = 0;
|
||||
|
||||
if serial {
|
||||
for file in files.iter_mut() {
|
||||
let mut output = String::new();
|
||||
|
@ -116,3 +118,12 @@ fn paste(filenames: Vec<String>, serial: bool, delimiters: String) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unescape all special characters
|
||||
// TODO: this will need work to conform to GNU implementation
|
||||
fn unescape(s: String) -> String {
|
||||
s.replace("\\n", "\n")
|
||||
.replace("\\t", "\t")
|
||||
.replace("\\\\", "\\")
|
||||
.replace("\\", "")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue