about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-02-23 23:24:29 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-02-23 23:24:29 +0000
commitb1ae269e555cb3997ebac0ceae936f563e3c67c1 (patch)
treed5b1334521eef1f69dcd68773c6c8a3f0f844d1e /Functions
parentfcc7489b7e8c2e572e94b1161ff37a6c0694d864 (diff)
downloadzsh-b1ae269e555cb3997ebac0ceae936f563e3c67c1.tar.gz
zsh-b1ae269e555cb3997ebac0ceae936f563e3c67c1.tar.xz
zsh-b1ae269e555cb3997ebac0ceae936f563e3c67c1.zip
18278: remove zgprintf, zformat already does this
Diffstat (limited to 'Functions')
-rw-r--r--Functions/TCP/tcp_open3
-rw-r--r--Functions/TCP/tcp_output2
-rw-r--r--Functions/TCP/tcp_spam4
-rw-r--r--Functions/TCP/zgprintf70
4 files changed, 5 insertions, 74 deletions
diff --git a/Functions/TCP/tcp_open b/Functions/TCP/tcp_open
index d9d5a96da..f762d932a 100644
--- a/Functions/TCP/tcp_open
+++ b/Functions/TCP/tcp_open
@@ -54,7 +54,8 @@ emulate -L zsh
 setopt extendedglob cbases
 
 zmodload -i zsh/net/tcp || return 1
-autoload -U zgprintf tcp_alias tcp_close tcp_command tcp_expect tcp_fd_handler
+zmodload -i zsh/zutil
+autoload -U tcp_alias tcp_close tcp_command tcp_expect tcp_fd_handler
 autoload -U tcp_log tcp_output tcp_proxy tcp_read tcp_rename tcp_send
 autoload -U tcp_sess tcp_spam tcp_talk tcp_wait
 
diff --git a/Functions/TCP/tcp_output b/Functions/TCP/tcp_output
index b22b79412..69177bae0 100644
--- a/Functions/TCP/tcp_output
+++ b/Functions/TCP/tcp_output
@@ -29,7 +29,7 @@ fi
 # where data is coming from; also, it allows more predictable
 # behaviour in tcp_expect.
 if [[ -n $tprompt ]]; then
-  zgprintf -R -%s=$sess -%f=$read_fd -- $tprompt
+  zformat -f REPLY $tprompt "s:$sess" "f:$read_fd"
   # We will pass this back up.
   REPLY="$REPLY$*"
 else
diff --git a/Functions/TCP/tcp_spam b/Functions/TCP/tcp_spam
index f5c612bee..b516ebaa2 100644
--- a/Functions/TCP/tcp_spam
+++ b/Functions/TCP/tcp_spam
@@ -91,7 +91,7 @@ for TCP_SESS in $sessions; do
     tcp_on_spam $TCP_SESS $cmd $*
     [[ $REPLY = done ]] && continue
   fi
-  [[ -n $verbose ]] && zgprintf -R -%s=$TCP_SESS \
-    -%f=${tcp_by_name[$TCP_SESS]} -- $TCP_PROMPT
+  [[ -n $verbose ]] && zformat REPLY $TCP_PROMPT "s:$TCP_SESS" \
+    "f:${tcp_by_name[$TCP_SESS]}"
   eval $cmd '$*'
 done
diff --git a/Functions/TCP/zgprintf b/Functions/TCP/zgprintf
deleted file mode 100644
index c448b35a2..000000000
--- a/Functions/TCP/zgprintf
+++ /dev/null
@@ -1,70 +0,0 @@
-# Generalised printf.
-# Arguments of the form -%X=... give the output to be used with
-# the directive %x.
-#
-# -P indicates that any unhandled directives are to be
-# passed to printf.  With this option, any %-escapes passed to printf
-# are assumed to consume exactly one argument from the command line.
-# Unused command line arguments are ignored.  This is only minimally
-# implemented.
-#
-# -R indicates the value is to be put into REPLY rather than printed.
-#
-# -r indicates that print formatting (backslash escapes etc.) should
-# not be replied to the result.  When using -R, no print formatting
-# is applied in any case.
-
-emulate -L zsh
-setopt extendedglob
-
-local opt printf fmt usereply match mbegin mend raw c
-typeset -A chars
-chars=(% %)
-
-while getopts "%:PrR" opt; do
-  case $opt in
-    (%) if [[ $OPTARG != ?=* ]]; then
-	  print -r "Bad % option: should be -%${OPTARG[1]}=..." >&2
-	  return 1
-	fi
-	chars[${OPTARG[1]}]=${OPTARG[3,-1]}
-	;;
-    (P) printf=1
-	;;
-    (r) raw=-r
-	;;
-    (R) usereply=1
-        ;;
-  esac
-done
-(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
-
-[[ -z $usereply ]] && local REPLY
-REPLY=
-
-if (( $# )); then
-  fmt=$1
-  shift
-fi
-
-while [[ $fmt = (#b)([^%]#)%([-0-9.*]#?)(*) ]]; do
-  REPLY+=$match[1]
-  c=$match[2]
-  fmt=$match[3]
-  if [[ -n ${chars[$c]} ]]; then
-    REPLY+=${chars[$c]}
-  elif [[ -n $P ]]; then
-    # hmmm, we need sprintf...
-    # TODO: %ld etc.
-    REPLY+=`printf "%$c" $1`
-    (( $? )) && return 1
-    shift
-  else
-    print -r "Format not handled: %$c" >&2
-    return 1
-  fi
-done
-
-REPLY+=$fmt
-[[ -z $usereply ]] && print -n $raw - $REPLY
-return 0