summaryrefslogtreecommitdiffstats
path: root/unix/dltest/pkga.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-04-04 08:06:07 (GMT)
committerhobbs <hobbs>2000-04-04 08:06:07 (GMT)
commit10736d4e37e044b5393fb9069608f7188ef0d9b3 (patch)
treec148d30d89ae800e8327ceff33eb33071645bba2 /unix/dltest/pkga.c
parentd629aa94a6179c6ebf2844bd69030aca52dd7d73 (diff)
downloadtcl-10736d4e37e044b5393fb9069608f7188ef0d9b3.zip
tcl-10736d4e37e044b5393fb9069608f7188ef0d9b3.tar.gz
tcl-10736d4e37e044b5393fb9069608f7188ef0d9b3.tar.bz2
* unix/dltest/pkg[a-e].c: Cleaned up test packages [Bug: 2293]
Diffstat (limited to 'unix/dltest/pkga.c')
-rw-r--r--unix/dltest/pkga.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/unix/dltest/pkga.c b/unix/dltest/pkga.c
index 4cda651..35bc95c 100644
--- a/unix/dltest/pkga.c
+++ b/unix/dltest/pkga.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkga.c,v 1.3 1999/03/11 21:47:40 stanton Exp $
+ * RCS: @(#) $Id: pkga.c,v 1.4 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
@@ -17,15 +17,15 @@
* Prototypes for procedures defined later in this file:
*/
-static int Pkga_EqCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkga_QuoteCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
+static int Pkga_EqObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int Pkga_QuoteObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
/*
*----------------------------------------------------------------------
*
- * Pkga_EqCmd --
+ * Pkga_EqObjCmd --
*
* This procedure is invoked to process the "pkga_eq" Tcl command.
* It expects two arguments and returns 1 if they are the same,
@@ -41,30 +41,28 @@ static int Pkga_QuoteCmd _ANSI_ARGS_((ClientData clientData,
*/
static int
-Pkga_EqCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkga_EqObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " string1 string2\"", (char *) NULL);
+ int result;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "string1 string2");
return TCL_ERROR;
}
- if (strcmp(argv[1], argv[2]) == 0) {
- interp->result = "1";
- } else {
- interp->result = "0";
- }
+ result = !strcmp(Tcl_GetString(objv[1]), Tcl_GetString(objv[2]));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * Pkga_quoteCmd --
+ * Pkga_QuoteObjCmd --
*
* This procedure is invoked to process the "pkga_quote" Tcl command.
* It expects one argument, which it returns as result.
@@ -79,18 +77,17 @@ Pkga_EqCmd(dummy, interp, argc, argv)
*/
static int
-Pkga_QuoteCmd(dummy, interp, argc, argv)
+Pkga_QuoteObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument strings. */
{
- if (argc != 2) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " value\"", (char *) NULL);
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "value");
return TCL_ERROR;
}
- strcpy(interp->result, argv[1]);
+ Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -125,9 +122,9 @@ Pkga_Init(interp)
if (code != TCL_OK) {
return code;
}
- Tcl_CreateCommand(interp, "pkga_eq", Pkga_EqCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand(interp, "pkga_quote", Pkga_QuoteCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkga_eq", Pkga_EqObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkga_quote", Pkga_QuoteObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}