summaryrefslogtreecommitdiff
path: root/bin/lsrc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/lsrc')
-rwxr-xr-xbin/lsrc72
1 files changed, 36 insertions, 36 deletions
diff --git a/bin/lsrc b/bin/lsrc
index d78b0ad..61ba0c4 100755
--- a/bin/lsrc
+++ b/bin/lsrc
@@ -18,14 +18,14 @@ popdir() {
}
build_path() {
- local dest=$1
- local file=$2
+ local dest="$1"
+ local file="$2"
local dotted=$3
if [ $dotted -eq 1 ]; then
- echo $dest/$file
+ echo "$dest/$file"
else
- echo $dest/.$file
+ echo "$dest/.$file"
fi
}
@@ -35,14 +35,14 @@ file_join() {
for file; do
if [ "x$file" != "x." ]; then
if [ "x$result" = "x" ]; then
- result=$file
+ result="$file"
else
result="$result/$file"
fi
fi
done
- echo $result
+ echo "$result"
}
show_dir() {
@@ -54,17 +54,17 @@ show_dir() {
local exclude_file_globs="$6"
local include_file_globs="$7"
local symlink_dirs_file_globs="$8"
- local dest_path=`build_path $dest_dir $dir $dotted`
+ local dest_path=`build_path "$dest_dir" "$dir" $dotted`
$DEBUG "show_dir $1 $2 $3 $4 $5 $6 $7 $8"
$VERBOSE "recurring on $dest_path"
- pushdir $dir
+ pushdir "$dir"
for f in *; do
$DEBUG "handling the file $f"
- next_dir=`file_join $dotfiles_subdir $dir`
- handle_file $f $dest_path $dotfiles_dir $next_dir 1 "$exclude_file_globs" "$include_file_globs" "$symlink_dirs_file_globs"
+ next_dir=`file_join "$dotfiles_subdir" "$dir"`
+ handle_file "$f" "$dest_path" "$dotfiles_dir" "$next_dir" 1 "$exclude_file_globs" "$include_file_globs" "$symlink_dirs_file_globs"
done
popdir
}
@@ -101,35 +101,35 @@ sigil_for() {
}
show_file() {
- local file=$1
- local dest_dir=$2
- local dotfiles_dir=$3
- local dotfiles_subdir=$4
+ local file="$1"
+ local dest_dir="$2"
+ local dotfiles_dir="$3"
+ local dotfiles_subdir="$4"
local dotted=$5
- local symlink_dirs_file_globs=$6
- local dest_file=`build_path $dest_dir $file $dotted`
+ local symlink_dirs_file_globs="$6"
+ local dest_file=`build_path "$dest_dir" "$file" $dotted`
if echo $DEST_STACK | grep -vq ":$dest_file"; then
DEST_STACK="$DEST_STACK:$dest_file"
- src_file=`file_join $dotfiles_subdir $file`
- abs_src_file=`file_join $dotfiles_dir $src_file`
- output=$dest_file:$abs_src_file
+ src_file=`file_join "$dotfiles_subdir" "$file"`
+ abs_src_file=`file_join "$dotfiles_dir" "$src_file"`
+ output="$dest_file:$abs_src_file"
if [ $SHOW_SIGILS -eq 1 ]; then
- sigil=`sigil_for $src_file "$symlink_dirs_file_globs"`
+ sigil=`sigil_for "$src_file" "$symlink_dirs_file_globs"`
output="$output:$sigil"
fi
- $PRINT $output
+ $PRINT "$output"
fi
}
handle_file() {
- local file=$1
- local dest_dir=$2
- local dotfiles_dir=$3
- local dotfiles_subdir=$4
+ local file="$1"
+ local dest_dir="$2"
+ local dotfiles_dir="$3"
+ local dotfiles_subdir="$4"
local dotted=$5
local exclude_file_globs="$6"
local include_file_globs="$7"
@@ -137,16 +137,16 @@ handle_file() {
$DEBUG "handle_file $1 $2 $3 $4 $5 $6 $7 $8"
- if [ ! -e $file ]; then
+ if [ ! -e "$file" ]; then
$VERBOSE "skipping non-existent file $file"
- elif is_excluded $file "$exclude_file_globs" "$include_file_globs"; then
+ elif is_excluded "$file" "$exclude_file_globs" "$include_file_globs"; then
$VERBOSE "skipping excluded file $file"
- elif [ -d $file ] && is_excluded $file "$symlink_dirs_file_globs"; then
- show_file $file $dest_dir $dotfiles_dir $dotfiles_subdir $dotted "$symlink_dirs_file_globs"
- elif [ -d $file ]; then
- show_dir $file $dest_dir $dotfiles_dir $dotfiles_subdir $dotted "$exclude_file_globs" "$include_file_globs" "$symlink_dirs_file_globs"
+ elif [ -d "$file" ] && is_excluded $file "$symlink_dirs_file_globs"; then
+ show_file "$file" "$dest_dir" "$dotfiles_dir" "$dotfiles_subdir" $dotted "$symlink_dirs_file_globs"
+ elif [ -d "$file" ]; then
+ show_dir "$file" "$dest_dir" "$dotfiles_dir" "$dotfiles_subdir" $dotted "$exclude_file_globs" "$include_file_globs" "$symlink_dirs_file_globs"
else
- show_file $file $dest_dir $dotfiles_dir $dotfiles_subdir $dotted
+ show_file "$file" "$dest_dir" "$dotfiles_dir" "$dotfiles_subdir" $dotted
fi
}
@@ -158,7 +158,7 @@ is_metafile() {
}
dotfiles_dir_excludes() {
- local dotfiles_dir=$1
+ local dotfiles_dir="$1"
local excludes="$2"
$DEBUG "dotfiles_dir_excludes $dotfiles_dir"
@@ -183,7 +183,7 @@ dotfiles_dir_excludes() {
}
is_excluded() {
- local file=$1
+ local file="$1"
local exclude_file_globs="$2"
local include_file_globs="$3"
@@ -193,10 +193,10 @@ is_excluded() {
$DEBUG "file: $file"
$DEBUG "exclude_file_glob: $exclude_file_glob"
- case $file in
+ case "$file" in
$exclude_file_glob)
for include_file_glob in $include_file_globs; do
- case $file in
+ case "$file" in
$include_file_glob) return 1;;
esac
done