diff options
Diffstat (limited to 'doc/ParseArgv.3')
-rw-r--r-- | doc/ParseArgv.3 | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3 index 65f184b..7749d92 100644 --- a/doc/ParseArgv.3 +++ b/doc/ParseArgv.3 @@ -60,8 +60,8 @@ elements of \fIargv\fR. .PP \fBTk_ParseArgv\fR normally returns the value \fBTCL_OK\fR. If an error occurs while parsing the arguments, then \fBTCL_ERROR\fR is returned and -\fBTk_ParseArgv\fR will leave an error message in \fIinterp->result\fR -in the standard Tcl fashion. In +\fBTk_ParseArgv\fR will leave an error message in the result of +interpreter \fIinterp\fR in the standard Tcl fashion. In the event of an error return, \fI*argvPtr\fR will not have been modified, but \fIargv\fR could have been partially modified. The possible causes of errors are explained below. @@ -70,12 +70,12 @@ The \fIargTable\fR array specifies the kinds of arguments that are expected; each of its entries has the following structure: .CS typedef struct { - char *\fIkey\fR; + const char *\fIkey\fR; int \fItype\fR; char *\fIsrc\fR; char *\fIdst\fR; - char *\fIhelp\fR; -} Tk_ArgvInfo; + const char *\fIhelp\fR; +} \fBTk_ArgvInfo\fR; .CE The \fIkey\fR field is a string such as .QW \-display @@ -186,7 +186,8 @@ specifiers of this type are ignored (as if they did not exist). \fBTK_ARGV_HELP\fR When this kind of option is encountered, \fBTk_ParseArgv\fR uses the \fIhelp\fR fields of \fIargTable\fR to format a message describing -all the valid arguments. The message is placed in \fIinterp->result\fR +all the valid arguments. The message is placed in interpreter +\fIinterp\fR's result and \fBTk_ParseArgv\fR returns \fBTCL_ERROR\fR. When this happens, the caller normally prints the help message and aborts. If the \fIkey\fR field of a \fBTK_ARGV_HELP\fR specifier is NULL, then the specifier will @@ -259,11 +260,12 @@ then return any that are left by compacting them to the beginning of \fIargv\fR (starting at \fIargv\fR[0]). \fIGenfunc\fR should return a count of how many arguments are left in \fIargv\fR; \fBTk_ParseArgv\fR will process them. If \fIgenfunc\fR encounters -an error then it should leave an error message in \fIinterp->result\fR, +an error then it should leave an error message in interpreter +\fIinterp\fR's result, in the usual Tcl fashion, and return \-1; when this happens \fBTk_ParseArgv\fR will abort its processing and return \fBTCL_ERROR\fR. .RE -.SH "FLAGS" +.SS "FLAGS" .TP \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR \fBTk_ParseArgv\fR normally treats \fIargv[0]\fR as a program @@ -312,14 +314,14 @@ Boolean exec = FALSE; Tk_ArgvInfo argTable[] = { {"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag, "Turn on debugging printfs"}, - {"\-N", TK_ARGV_INT, (char *) NULL, (char *) &numReps, + {"\-N", TK_ARGV_INT, NULL, (char *) &numReps, "Number of repetitions"}, - {"\-of", TK_ARGV_STRING, (char *) NULL, (char *) &fileName, + {"\-of", TK_ARGV_STRING, NULL, (char *) &fileName, "Name of file for output"}, - {"x", TK_ARGV_REST, (char *) NULL, (char *) &exec, + {"x", TK_ARGV_REST, NULL, (char *) &exec, "File to exec, followed by any arguments (must be last argument)."}, - {(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL, - (char *) NULL} + {NULL, TK_ARGV_END, NULL, NULL, + NULL} }; main(argc, argv) @@ -329,7 +331,7 @@ main(argc, argv) \&... if (Tk_ParseArgv(interp, tkwin, &argc, argv, argTable, 0) != TCL_OK) { - fprintf(stderr, "%s\en", interp->result); + fprintf(stderr, "%s\en", Tcl_GetString(Tcl_GetObjResult(interp))); exit(1); } |