mirror of
https://github.com/xroche/httrack.git
synced 2026-06-25 11:37:28 +03:00
Mechanical pass: run shfmt -i 4 over the whole tracked shell tree (the test harness .test files, the regen generators, webhttrack, the CGI search helper, and the build/dist scripts) so they share one style. shfmt also normalised backticks to $(...) and $[..] to $((..)). No behaviour change: arithmetic is preserved exactly, non-ASCII bytes are untouched, and the full make check suite still passes. The tab indented .test files become 4-space indented, hence the wide diff. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
# path simplify engine (fil_simplifie): collapses ./ and ../ segments.
|
|
simp() {
|
|
test "$(httrack -O /dev/null -#1 "$1")" == "simplified=$2" || exit 1
|
|
}
|
|
|
|
simp './foo/bar/' 'foo/bar/'
|
|
simp './foo/bar' 'foo/bar'
|
|
simp './foo/./bar' 'foo/bar'
|
|
simp './foo/bar/.././tmp/foobar' 'foo/tmp/foobar'
|
|
simp './foo/bar/.././tmp/foobar/../foobaz' 'foo/tmp/foobaz'
|
|
|
|
# single '..' collapses one segment
|
|
simp './a/../b' 'b'
|
|
simp './a/b/../../c' 'c'
|
|
|
|
# repeated './' is squeezed
|
|
simp './a/./././b' 'a/b'
|
|
|
|
# leading '..' that would go above the root is discarded, per RFC 3986 §5.2.4
|
|
simp './a/../../b' 'b'
|
|
|
|
# empty segments ('//') are not dot-segments and are preserved, per RFC 3986
|
|
simp 'a//b' 'a//b'
|
|
simp 'a//b/../c' 'a//c'
|
|
|
|
# absolute paths keep the leading '/'; above-root '..' is clamped to it
|
|
simp '/a/../b' '/b'
|
|
simp '/a/../../b' '/b'
|
|
simp '/../x' '/x'
|
|
|
|
# collapses to nothing -> './' (relative) or '/' (absolute)
|
|
simp '..' './'
|
|
simp 'a/..' './'
|
|
simp '/' '/'
|
|
|
|
simp 'a/b/..' 'a/' # trailing bare '..'
|
|
simp 'a/../b?x=../y' 'b?x=../y' # '?' freezes simplification
|