diff --git a/home/zshrc b/home/zshrc index ec504e8..efde2b4 100644 --- a/home/zshrc +++ b/home/zshrc @@ -48,7 +48,7 @@ autoload history-search-end zmodload zsh/mathfunc function { - local a b + local a= b= # combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh, # but only recompile the output if the sha1sum has changed. diff --git a/sh/archive b/sh/archive index 9f56e7e..e9650cd 100755 --- a/sh/archive +++ b/sh/archive @@ -12,7 +12,7 @@ archive() { # Matt Hamilton # - local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin + local archive_name= path_to_archive= _gzip_bin= _bzip2_bin= _xz_bin= _zstd_bin= if (( $# < 2 )); then cat >&2 <&2; return 1; } - local c d + local c= d= for d in *(FDN); do print $(find $d 2>/dev/null | wc -l) $d done | sort -nr | while read c d; do diff --git a/sh/compile b/sh/compile index c5c2ebb..693f543 100755 --- a/sh/compile +++ b/sh/compile @@ -90,18 +90,17 @@ compile() { ### @- local clang="$(whence -p clang 2>/dev/null)" local clang_flags=() # currently just for clang-msvc - local cl - local vc + local cl= vc= if [ -n "$MSYSTEM" ]; then # using msys2? if [ -z "$clang" ]; then # don't have native clang? # then maybe we have clang-msvc installed. - local dir + local dir= printf "%s\n" "/c/Program Files/LLVM"*(On/N[1]) | read -r dir if [ -d "$dir" ] && [ -e "$dir/bin/clang" ]; then clang="$dir/bin/clang" # not sure if i'll need this: - #local clang_include + #local clang_include= #printf "%s\n" "$dir/lib/clang/"*(On/N[1]) | read -r clang_include #[ -n "$clang_include" ] || { echo "failed glob; missing clang include" >&2; return 1 } #clang_flags+=(-I"$clang_include/include") @@ -110,7 +109,7 @@ compile() { ### @- fi fi - local winkit + local winkit= printf "%s\n" "/c/Program Files (x86)/Windows Kits/"*(on/N[1]) | read -r winkit [ -z "$winkit" ] || printf "%s\n" "$winkit/Lib/"*(On/N[1]) | read -r winkit @@ -119,9 +118,7 @@ compile() { ### @- : else # detect MSVC. - local clarch - local arch - local msvc_dig_deep + local clarch= arch= msvc_dig_deep= [ "$MSYSTEM" = MINGW64 ] && clarch="/amd64" || clarch="" [ "$MSYSTEM" = MINGW64 ] && arch="x64" || arch="x86" if [ -d "/c/Program Files (x86)/Microsoft Visual Studio" ]; then # 2017+ @@ -179,9 +176,9 @@ compile() { ### @- fi # set some defaults. - local sepples=0 - [ -n "$clang" ] && local CC=clang || local CC=gcc - [ -n "$clang" ] && local CXX=clang++ || local CXX=g++ + local sepples=0 CC= CXX= + [ -n "$clang" ] && CC=clang || CC=gcc + [ -n "$clang" ] && CXX=clang++ || CXX=g++ local our_flags=(-I.) # guess if we're compiling C++ by the file extension. @@ -263,10 +260,11 @@ compile() { ### @- fi fi + local gold= # utilize clang's vast debugging and hardening features where available. if [ $CC = clang ]; then debug_flags+=(-ftrapv) - [ -z "$MSYSTEM" ] && local gold=gold || local gold=lld + [ -z "$MSYSTEM" ] && gold=gold || gold=lld [ -n "$MSYSTEM" ] && our_flags+=(-fansi-escape-codes) || true if [ $clang_msvc -eq 1 ] || [ -z "$MSYSTEM" ]; then debug_flags+=(-fsanitize=undefined) # this SHOULD work with mingw, @@ -302,9 +300,7 @@ compile() { ### @- # allow multiple source files (using the firstmost to determine the program name) # by generating a file that #includes each given file. - local final_flags=() - local libraries=() - local warnings=() + local final_flags=() libraries=() warnings=() for flag in $our_flags $flags; do # move -l flags to the end because gcc won't respect them otherwise. if [[ $flag == -l* ]]; then diff --git a/sh/document b/sh/document index f9315c1..bf9f98d 100755 --- a/sh/document +++ b/sh/document @@ -69,7 +69,7 @@ document2() { esac if [ -n "$n" ]; then - local url + local url= # different subdirs need to be handled differently: [ "$f" != "${f#sh/}" ] && url="/sh/${f#sh/}#L$c" || url="/home/${f#.}#L$c" if [ "$n" = "$e" ]; then @@ -117,7 +117,7 @@ document1() { # create new output file (with a tilde as not to overwrite just yet): : > "$out" || return 4 - local line + local line= if [ -f "$in_" ]; then # copy existing lines up to (and including) the "DOCUMENT" marker: diff --git a/sh/lsarchive b/sh/lsarchive index 043f75c..a42861d 100755 --- a/sh/lsarchive +++ b/sh/lsarchive @@ -12,7 +12,7 @@ lsarchive() { # Sorin Ionescu # - local verbose + local verbose= if (( $# == 0 )); then cat >&2 < # - local remove_archive - local success - local file_name - local file_path - local extract_dir - local _gzip_bin _bzip2_bin _xz_bin _zstd_bin + local remove_archive= + local success= + local file_name= + local file_path= + local extract_dir= + local _gzip_bin= _bzip2_bin= _xz_bin= _zstd_bin= if (( $# == 0 )); then cat >&2 <