summaryrefslogtreecommitdiffstats
path: root/contrib/tcl/doc/WrongNumArgs.3
blob: 528ebc827511f6f987354b067b449858caf231be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'\"
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" SCCS: @(#) @(#) WrongNumArgs.3 1.3 97/03/18 11:53:25
'\" 
.so man.macros
.TH Tcl_WrongNumArgs 3 8.0 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_WrongNumArgs \- generate standard error message for wrong number of arguments
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
\fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR)
.SH ARGUMENTS
.AS Tcl_Interp "*CONST objv[]"
.AP Tcl_Interp interp in
Interpreter in which error will be reported: error message gets stored
in its result object.
.AP int objc in
Number of leading arguments from \fIobjv\fR to include in error
message.
.TP
Tcl_Obj	*CONST \fIobjv\fR[]	(in)
Arguments to command that had the wrong number of arguments.
.AP char *message in
Additional error information to print after leading arguments
from \fIobjv\fR.  This typically gives the acceptable syntax
of the command.
.BE

.SH DESCRIPTION
.PP
\fBTcl_WrongNumArgs\fR is a utility procedure that is invoked by
command procedures when they discover that they have received the
wrong number of arguments.  \fBTcl_WrongNumArgs\fR generates a
standard error message and stores it in the result object of
\fIinterp\fR.  The message includes the \fIobjc\fR initial
elements of \fIobjv\fR plus \fImessage\fR.  For example, if
\fIobjv\fR consists of the values \fBfoo\fR and \fBbar\fR,
\fIobjc\fR is 1, and \fImessage\fR is ``\fBfileName count\fR''
then \fIinterp\fR's result object will be set to the following
string:
.CS
wrong # args: should be "foo fileName count"
.CE
If \fIobjc\fR is 2, the result will be set to the following string:
.CS
wrong # args: should be "foo bar fileName count"
.CE
\fIObjc\fR is usually 1, but may be 2 or more for commands like \fBstring\fR
and the Tk widget commands, which use the first argument as a subcommand.

.SH KEYWORDS
command, error message, wrong number of arguments
OpenPOWER on IntegriCloud