summaryrefslogtreecommitdiffstats
path: root/doc/unknown.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-30 14:13:52 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-30 14:13:52 (GMT)
commit57f4b29cd4df15192d915e8a7623aaef878815a3 (patch)
tree6f8d5a79be52073a4436d0457ba2cf447dc7a9d3 /doc/unknown.n
parentb38d81697b3dec3794ad6b2b423391fb313306bf (diff)
downloadtcl-57f4b29cd4df15192d915e8a7623aaef878815a3.zip
tcl-57f4b29cd4df15192d915e8a7623aaef878815a3.tar.gz
tcl-57f4b29cd4df15192d915e8a7623aaef878815a3.tar.bz2
Added example
Diffstat (limited to 'doc/unknown.n')
-rw-r--r--doc/unknown.n16
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/unknown.n b/doc/unknown.n
index 2ef5b14..95bb066 100644
--- a/doc/unknown.n
+++ b/doc/unknown.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: unknown.n,v 1.4 2001/06/27 21:00:45 hobbs Exp $
+'\" RCS: @(#) $Id: unknown.n,v 1.5 2004/05/30 14:13:52 dkf Exp $
'\"
.so man.macros
.TH unknown n "" Tcl "Tcl Built-In Commands"
@@ -71,6 +71,20 @@ auto-exec step is skipped.
Under normal circumstances the return value from \fBunknown\fR
is the return value from the command that was eventually
executed.
+.SH EXAMPLE
+Arrange for the \fBunknown\fR command to have its standard behavior
+except for first logging the fact that a command was not found:
+.PP
+.CS
+# Save the original one so we can chain to it
+rename \fBunknown\fR _original_unknown
+
+# Provide our own implementation
+proc \fBunknown\fR args {
+ puts stderr "WARNING: unknown command: $args"
+ uplevel 1 [list _original_unknown {expand}$args]
+}
+.CE
.SH "SEE ALSO"
info(n), proc(n), interp(n), library(n)