62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
static void TestFileHandlerProc(ClientData clientData, int mask);
static int TestfilehandlerCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestfilewaitCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestfindexecutableCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestgetopenfileCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestgetdefencdirCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestsetdefencdirCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
int TclplatformtestInit(Tcl_Interp *interp);
|
>
>
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
static void TestFileHandlerProc(ClientData clientData, int mask);
static int TestfilehandlerCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestfilewaitCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestfindexecutableCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestforkObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc, Tcl_Obj *CONST *argv);
static int TestgetopenfileCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestgetdefencdirCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
static int TestsetdefencdirCmd(ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv);
int TclplatformtestInit(Tcl_Interp *interp);
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
Tcl_CreateCommand(interp, "testchmod", TestchmodCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfilehandler", TestfilehandlerCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfilewait", TestfilewaitCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfindexecutable", TestfindexecutableCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd,
(ClientData) 0, NULL);
|
>
>
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
Tcl_CreateCommand(interp, "testchmod", TestchmodCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfilehandler", TestfilehandlerCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfilewait", TestfilewaitCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfindexecutable", TestfindexecutableCmd,
(ClientData) 0, NULL);
Tcl_CreateObjCommand(interp, "testfork", TestforkObjCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd,
(ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd,
(ClientData) 0, NULL);
|
529
530
531
532
533
534
535
536
537
538
539
540
541
542
|
" defaultDir\"", NULL);
return TCL_ERROR;
}
Tcl_SetDefaultEncodingDir(argv[1]);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestgetdefencdirCmd --
*
* This function implements the "testgetdefenc" command. It is used to
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
" defaultDir\"", NULL);
return TCL_ERROR;
}
Tcl_SetDefaultEncodingDir(argv[1]);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestforkObjCmd --
*
* This function implements the "testfork" command. It is used to
* fork the Tcl process for specific test cases.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
TestforkObjCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST *objv) /* Argument strings. */
{
pid_t pid;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, "");
return TCL_ERROR;
}
pid = fork();
if (pid == -1) {
Tcl_AppendResult(interp,
"Cannot fork", NULL);
return TCL_ERROR;
}
if (pid==0) {
Tcl_InitNotifier();
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(pid));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestgetdefencdirCmd --
*
* This function implements the "testgetdefenc" command. It is used to
|