From 382f2806066a078f2168ca7817a44ca0aad93433 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 14 Dec 2022 14:51:19 +0100 Subject: [PATCH] fix shell_replace issue --- bin/shell-replace | 12 ++++++++---- etc/profile.d/nb.sh | 2 +- etc/vim/source/vars.vim | 4 ++-- lib/php/http.php | 2 +- lib/php/mime.php | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/shell-replace b/bin/shell-replace index e944f262..cdc2f72a 100755 --- a/bin/shell-replace +++ b/bin/shell-replace @@ -34,6 +34,7 @@ get_options(\%Opt); #help() unless @ARGV; $main::_DATA_ = undef; $Opt{find} = 1 if $Opt{'find-only'}; +$Opt{extension} =~ s/^\.// if $Opt{extension}; ################################################################################# # @@ -68,9 +69,11 @@ if ($Opt{find}) { follow_skip => 2, no_chdir => 1 }, @ARGV); - #exit; + if ($Opt{'find-only'}) { + print map {"$_\n"} @WANTED_FILES; + exit; + } @ARGV = @WANTED_FILES; - exit if $Opt{'find-only'}; } # @@ -171,7 +174,7 @@ sub wanted { #warn "$file ".(-r $file ? "YES" : "NO"); # Dont want the myself - return if myself($file); + return if &myself($file); my $hfile; open($hfile,"<","$file"); @@ -180,7 +183,8 @@ sub wanted { # Dont want the myself next if /$SHELL_IGNORE/; - next unless /^.{1,3}]SHELL_REPLACE/; verbose(1,"Found: $file"); push @WANTED_FILES, $file; diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 58f291ed..9dfad210 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -86,7 +86,7 @@ nb_php() { nb_api() { local uri="$1"; shift local auth="" - #=SHELL_REPLACE echo ssh root@ldap.nbdom.net grep CLEARTEXT /etc/ldap/nbdom.net/auth/nb.ldif | awk -F '}' '{print "NB_AUTH=\"nb:"$2"\""}' + #=SHELL_REPLACE ssh root@ldap.nbdom.net grep CLEARTEXT /etc/ldap/nbdom.net/auth/nb.ldif | awk -F '}' '{print "auth=\"nb:"$2"\""}' [ -z "$auth" ] && auth="nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT" diff --git a/etc/vim/source/vars.vim b/etc/vim/source/vars.vim index 5e6b3999..e96bd4f5 100644 --- a/etc/vim/source/vars.vim +++ b/etc/vim/source/vars.vim @@ -9,7 +9,7 @@ let mimeExt = { let mimeAliases = { \ 'sh' : 'bash' \} -">SHELL_REPLACE dbq db=nb t=meta action=table.rows rows.fields=key,val cat=file.check format=vim_hash name=mimeCheck preff="$(printf "\t")" +">SHELL_REPLACE dbq db=nb t=meta action=table.rows rows.fields=key,val cat=file.check orderby=key format=vim_hash name=mimeCheck preff="$(printf "\t")" let mimeCheck = { \ 'awk' : 'awk < /dev/null --lint=no-ext --file' \,'bash' : 'bash -c' @@ -30,7 +30,7 @@ let mimeCheck = { \} "SHELL_REPLACE dbq.php nb meta ls key,val cat=mime.comment format=vim_hash preff="$(printf "\t")" name=mimeComment +">SHELL_REPLACE dbq.php nb meta ls key,val cat=mime.comment orderby=key format=vim_hash preff="$(printf "\t")" name=mimeComment let mimeComment = { \ 'bindzone' : ';' \,'c' : '//' diff --git a/lib/php/http.php b/lib/php/http.php index 911d9798..017f4e24 100644 --- a/lib/php/http.php +++ b/lib/php/http.php @@ -1,7 +1,7 @@ SHELL_REPLACE dbq.php /$NB_DB/http_status/ls/id,name orderby=id format=php_hash preff=$'\t' +#>SHELL_REPLACE dbq.php /$NB_DB/http_status/ls/id,name orderby=id format=php_hash preff="$(printf '\t\t')" "100" => "Continue", "101" => "Switching Protocols", "102" => "Processing", diff --git a/lib/php/mime.php b/lib/php/mime.php index 8c9558c0..60af090a 100644 --- a/lib/php/mime.php +++ b/lib/php/mime.php @@ -1,7 +1,7 @@ SHELL_REPLACE dbq "/pub/mime/ls/type,ext.php_hash?preff=%09%09" +#>SHELL_REPLACE dbq "/pub/mime/ls/type,ext.php_hash?preff=%09%09&orderby=type" "application/applixware" => "aw", "application/atomcat+xml" => "atomcat", "application/atomsvc+xml" => "atomsvc", -- 2.47.3