mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #2519 from jfinkels/pathchk-remove-double-negation
pathchk: remove double negation
This commit is contained in:
commit
978033a241
1 changed files with 1 additions and 6 deletions
|
@ -170,7 +170,7 @@ fn check_basic(path: &[String]) -> bool {
|
||||||
fn check_extra(path: &[String]) -> bool {
|
fn check_extra(path: &[String]) -> bool {
|
||||||
// components: leading hyphens
|
// components: leading hyphens
|
||||||
for p in path {
|
for p in path {
|
||||||
if !no_leading_hyphen(p) {
|
if p.starts_with('-') {
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut std::io::stderr(),
|
&mut std::io::stderr(),
|
||||||
"leading hyphen in file name component '{}'",
|
"leading hyphen in file name component '{}'",
|
||||||
|
@ -236,11 +236,6 @@ fn check_searchable(path: &str) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a hyphen at the beginning of a path segment
|
|
||||||
fn no_leading_hyphen(path_segment: &str) -> bool {
|
|
||||||
!path_segment.starts_with('-')
|
|
||||||
}
|
|
||||||
|
|
||||||
// check whether a path segment contains only valid (read: portable) characters
|
// check whether a path segment contains only valid (read: portable) characters
|
||||||
fn check_portable_chars(path_segment: &str) -> bool {
|
fn check_portable_chars(path_segment: &str) -> bool {
|
||||||
const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
|
const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue