=== modified file 'bin/fslist' --- bin/fslist 2014-06-20 14:09:59 +0000 +++ bin/fslist 2013-12-09 18:54:33 +0000 @@ -34,36 +34,22 @@ delim='' } -ROOT=${${${ROOT:-$PWD}:a}%/} -: ${compact:=1} - fnames=( ) -for arg in "${@:-$ROOT}"; do +for arg in "${@:-$PWD}"; do fnames+=( $arg:a ) [[ -d $arg ]] && fnames+=( $arg:a/**/* ) done for fname in $fnames; do - if ! [[ $fname == $ROOT || $fname == $ROOT/* ]]; then - printf "skipping out-of-root file: %s\n" "$fname" >&2 - continue - fi - relname=${${fname#$ROOT}#/} zstat -LH s $fname || continue ftype=$(( [##16] $s[mode] >> 12 )) fmode=$(( [##8] $s[mode] & 8#7777 )) t=$ftypes[$ftype] - (($compact)) || printf '\n' - - if [[ $relname == *$'\t'* || $relname == *$'\n'* ]]; then - statement $'P\t'$relname $'\t' + if [[ $fname == *$'\t'* || $fname == *$'\n'* ]]; then + statement $'P\t'$fname $'\t' else - if (($compact)); then - statement /$relname - else - statement /$relname $'\n' - fi + statement $fname fi if [[ $t != d && $s[nlink] -gt 1 ]]; then @@ -72,7 +58,7 @@ statement $'H\t'$hardlinks[$id] $'\n' continue else - hardlinks[$id]=./$relname + hardlinks[$id]=$fname fi fi @@ -92,7 +78,7 @@ else flags+=N fi - if ! (($compact)) || [[ $content == *$'\t'* || $content == *$'\n'* ]]; then + if [[ $content == *$'\t'* || $content == *$'\n'* ]]; then statement C$flags$'\t'$content $'\n' else statement c$flags$'\t'$content