commit 76ca64e5f85f5b6e7608644ff8a48293530dc289
parent 0a3ede80aa047c34fda23a907888c16a1b16408d
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Thu, 26 Sep 2013 22:09:40 +0200
canonicalize commands to uppercase iff it reads till the end of the statement
Diffstat:
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/bin/fileset.awk b/bin/fileset.awk
@@ -198,17 +198,22 @@ function process_statement() {
}
# cat, copy, content; eats rest of statement and puts it into the file
- if(cchar == "c") {
+ if(cchar ~ /[cC]/) {
cmd_mknod("test -f "fname, "file")
+ if(cchar == "C") {
+ content = statement
+ statement = ""
+ } else {
+ content = get_till_tab()
+ }
# unless disabled with the N flag, append newline at the end of
# last line, if not already present
- printf_fmt = crest ~ /n/ || (crest !~ /N/ && statement !~ /\n$/) ? \
+ printf_fmt = crest ~ /n/ || (crest !~ /N/ && content !~ /\n$/) ? \
"%s\\n" : "%s"
printf_redir = (crest ~ /a/ ? ">>" : ">") fname
- # print_i("content="quoted(statement))
+ # print_i("content="quoted(content))
# print_d("printf "printf_redir" '"printf_fmt"' \"$content\"")
- print_d("printf "printf_redir" '"printf_fmt"' "quoted(statement))
- statement = ""
+ print_d("printf "printf_redir" '"printf_fmt"' "quoted(content))
continue
}
diff --git a/bin/fslist b/bin/fslist
@@ -7,12 +7,12 @@ zmodload zsh/stat
typeset -A ftypes hardlinks
ftypes=( # convert hex type to mnemonic character
- c S # socket
+ c s # socket
a l # symbolic link
8 f # regular file
- 6 B # block device
+ 6 b # block device
4 d # directory
- 2 C # character device
+ 2 u # character device
1 p # FIFO
)
@@ -76,7 +76,11 @@ for arg in "${@:-$PWD}"; do
else
flags+=N
fi
- statement c$flags$'\t'$content $'\n'
+ if [[ $content == *$'\t'* || $content == *$'\n'* ]]; then
+ statement C$flags$'\t'$content $'\n'
+ else
+ statement c$flags$'\t'$content $'\n'
+ fi
fi
statement o$s[uid]:$s[gid]
statement m$fmode