zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _netcat
@ 2002-03-10  4:17 Clint Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Clint Adams @ 2002-03-10  4:17 UTC (permalink / raw)
  To: zsh-workers

This is from Matt Zimmerman.  He points out that
nc conflicts with _nedit.  On Debian this isn't an issue
(nedit's nc is distributed as nedit-nc), so the compdef
line in _nedit can be changed accordingly.

Elsewhere, I can't think of a good solution.

Index: Completion/Unix/Command/_netcat
===================================================================
RCS file: Completion/Unix/Command/_netcat
diff -N Completion/Unix/Command/_netcat
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_netcat	10 Mar 2002 04:10:50 -0000
@@ -0,0 +1,34 @@
+#compdef nc netcat
+
+local curcontext="$curcontext" state line expl
+typeset -A opt_args
+
+if (( ! $+_nc_args )); then
+  local help="$(_call_program options nc -h < /dev/null 2>&1)"
+  local -A optionmap
+  optionmap=(
+    '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
+     '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
+     '*-G num*' '-G[source-routing pointer: 4, 8, 12]'
+     '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:secs:'
+     '*-l*' '-l[listen mode]'
+     '*-n*' '-n[numeric-only IP addresses, no DNS]'
+     '*-o file*' '-o+[hex dump of traffic]:file:_files'
+     '*-p port*' '-p+[local port number]:port:_ports'
+     '*-r*' '-r[randomize local and remote ports]'
+     '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:secs:'
+     '*-t*' '-t[answer TELNET negotiation]'
+     '*-u*' '-u[UDP mode]'
+     '*-v*' '-v[verbose]'
+     '*-w secs*' '-w+[timeout for connects and final net reads]:secs:'
+     '*-z*' '-z[zero-I/O mode]'
+     '*-x*' '-x'
+     '*-b*' '-b[allow broadcasts]'
+  )
+  _nc_args=($optionmap[(K)"$help"])
+fi
+
+_arguments -C -s \
+  "$_nc_args[@]" \
+  ':host:_hosts' \
+  ':port:_ports' && return 0


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: PATCH: _netcat
@ 2002-03-10 22:25 Bart Schaefer
  2002-03-11 11:26 ` Oliver Kiddle
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2002-03-10 22:25 UTC (permalink / raw)
  To: zsh-workers

} nc conflicts with _nedit.  On Debian this isn't an issue
} (nedit's nc is distributed as nedit-nc), so the compdef
} line in _nedit can be changed accordingly.
} 
} Elsewhere, I can't think of a good solution.

The one thing we *can't* do is leave `#compdef nc' in *both* of them, as
has been the case since you checked in _netcat.  If it's in both of them,
the one that is chosen for `nc' will vary depending on whether zsh was
configured with --enable-function-subdirs.

What if we were to create a new Completion/X/Command/_nc that contains:

#compdef -p *X*/nc
_nedit "$@"

This would mean that if the `nc' found first in the user's path were under
a directory with `X' in its name, it would complete as if for _nedit, else
it will use the `nc' compdef from _netcat.

Then we'd change the #compdef in _nedit to read

#compdef nedit nedit-nc

or whatever is appropriate.

Anybody foresee problems with this?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-03-20  9:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-10  4:17 PATCH: _netcat Clint Adams
2002-03-10 22:25 Bart Schaefer
2002-03-11 11:26 ` Oliver Kiddle
2002-03-12 17:38   ` Oliver Kiddle
2002-03-13  8:32     ` Sven Wischnowsky
2002-03-14 12:22       ` Oliver Kiddle
2002-03-15  8:39         ` Sven Wischnowsky
2002-03-15 16:06           ` Oliver Kiddle
2002-03-15 16:45             ` Bart Schaefer
2002-03-20  9:23             ` Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).