-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmdModule.c
746 lines (643 loc) · 21.7 KB
/
cmdModule.c
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
/*****
** ** Module Header ******************************************************* **
** **
** Modules Revision 3.0 **
** Providing a flexible user environment **
** **
** File: cmdModule.c **
** First Edition: 1991/10/23 **
** **
** Authors: John Furlan, jlf@behere.com **
** Jens Hamisch, jens@Strawberry.COM **
** R.K. Owen, <rk@owen.sj.ca.us> or <rkowen@nersc.gov> **
** **
** Description: The actual module command from the Tcl level. This **
** routines calls other ModuleCmd routines to carry out **
** the subcommand requested. **
** **
** Exports: cmdModule **
** Read_Modulefile **
** Execute_TclFile **
** CallModuleProcedure **
** **
** Notes: **
** **
** ************************************************************************ **
****/
/** ** Copyright *********************************************************** **
** **
** Copyright 1991-1994 by John L. Furlan. **
** see LICENSE.GPL, which must be provided, for details **
** **
** ************************************************************************ **/
static char Id[] = "@(#)$Id$";
static void *UseId[] = { &UseId, Id };
/** ************************************************************************ **/
/** HEADERS **/
/** ************************************************************************ **/
#include "modules_def.h"
/** ************************************************************************ **/
/** LOCAL DATATYPES **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** CONSTANTS **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** MACROS **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** LOCAL DATA **/
/** ************************************************************************ **/
char _fil_stdin[] = "stdin";
char _fil_stdout[] = "stdout";
char _fil_stderr[] = "stderr";
char _fil_devnull[] = "/dev/null";
int linenum = 0;
static char module_name[] = __FILE__;
char *module_command;
/** ************************************************************************ **/
/** PROTOTYPES **/
/** ************************************************************************ **/
/** not applicable **/
/*++++
** ** Function-Header ***************************************************** **
** **
** Function: cmdModule **
** **
** Description: Evaluation of the module command line and callup of **
** the according subroutine **
** **
** First Edition: 1991/10/23 **
** **
** Parameters: ClientData client_data **
** Tcl_Interp *interp According Tcl interp.**
** int objc Number of arguments **
** Tcl_Obj *objv[] Argument array **
** **
** Result: int TCL_OK Successful completion **
** TCL_ERROR Any error **
** **
** Attached Globals: g_flags These are set up accordingly before **
** this function is called in order to **
** control everything **
** g_current_module The module which is handled **
** by the current command **
** **
** ************************************************************************ **
++++*/
int cmdModule(
ClientData client_data,
Tcl_Interp * interp,
int objc,
Tcl_Obj * CONST84 objv[]
) {
int return_val = -1, /** exit return value **/
store_flags = g_flags, /** local copy of flags **/
match = 0, /** found match **/
i;
char *store_curmodule = NULL, /** current module name **/
*save_module_command = NULL; /** save module command **/
/**
** These skip the arguments past the shell and command.
**/
int num_modulefiles = objc - 2;
char **modulefile_list;
int argc;
#if 0
int x = 0;
# define _XD fprintf(stderr,":%d:",++x),
#else
# define _XD
#endif
#define _MTCH _XD match =
#define _ISERR ((match == -1) && (*TCL_RESULT(interp)))
#define _TCLCHK(a) {if(_ISERR) ErrorLogger(ERR_EXEC,LOC,TCL_RESULT(a),NULL);}
/**
** Help or whatis mode?
**/
if (g_flags & (M_HELP | M_WHATIS))
return (TCL_OK);
/**
** Parameter check
**/
if (objc < 2) {
(void)ErrorLogger(ERR_USAGE, LOC, "module", " command ",
" [arguments ...] ", NULL);
(void)ModuleCmd_Help(interp, 0, NULL);
return (TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
/**
** Non-persist mode?
**/
if (g_flags & M_NONPERSIST) {
return (TCL_OK);
}
/**
** Display whatis mode?
**/
if (g_flags & M_DISPLAY) {
fprintf(stderr, "%s\t\t ", Tcl_GetString(objv[0]));
for (i = 1; i < objc; i++)
fprintf(stderr, "%s ", Tcl_GetString(objv[i]));
fprintf(stderr, "\n");
return (TCL_OK);
}
/**
** For recursion. This can be called multiple times.
**/
save_module_command = module_command;
module_command = stringer(NULL, 0, Tcl_GetString(objv[1]), NULL);
if (g_current_module)
store_curmodule = g_current_module;
/* convert the modulefile_list from Objv to Argv to pass along */
Tcl_ObjvToArgv(&argc, &modulefile_list, objc - 2, objv + 2);
/**
** If the command is '-', we want to just start
** interpreting Tcl from stdin.
**/
if (_XD ! strcmp(module_command, "-")) {
return_val = Execute_TclFile(interp, _fil_stdin);
/**
** Evaluate the module command and call the according subroutine
** --- module LOAD|ADD
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, addRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Load(interp, 1, num_modulefiles, modulefile_list);
/**
** keep track of the number of modulefiles that did not load. for any reason
**/
g_retval = num_modulefiles - return_val;
/**
** We always say the load succeeded. ModuleCmd_Load will
** output any necessary error messages.
**/
return_val = TCL_OK;
/**
** --- module UNLOAD
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, rmRE))) {
_TCLCHK(interp);
return_val = ModuleCmd_Load(interp, 0, num_modulefiles, modulefile_list);
/**
** keep track of the number of modulefiles that did not load. for any reason
**/
g_retval = num_modulefiles - return_val;
return_val = TCL_OK;
/**
** --- module SWITCH
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, swRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Switch(interp, num_modulefiles, modulefile_list);
/**
** --- module DISPLAY
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, dispRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Display(interp, num_modulefiles, modulefile_list);
/**
** --- module LIST
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, listRE))) {
_TCLCHK(interp);
if (!(sw_format & SW_SET)) { /* default format options */
sw_format |= (SW_HUMAN | SW_TERSE);
sw_format &= ~(SW_PARSE | SW_LONG);
}
/* use SW_LIST to indicate LIST & not AVAIL */
sw_format |= SW_LIST;
return_val =
ModuleCmd_List(interp, num_modulefiles, modulefile_list);
/**
** --- module AVAIL
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, availRE))) {
_TCLCHK(interp);
if (!(sw_format & SW_SET)) { /* default format options */
sw_format |= (SW_HUMAN | SW_TERSE);
sw_format &= ~(SW_PARSE | SW_LONG);
}
/* use SW_LIST to indicate LIST & not AVAIL */
sw_format &= ~SW_LIST;
return_val =
ModuleCmd_Avail(interp, num_modulefiles, modulefile_list);
/**
** --- module WHATIS and APROPOS
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, whatisRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Whatis(interp, num_modulefiles, modulefile_list);
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, aproposRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Apropos(interp, num_modulefiles, modulefile_list);
/**
** --- module CLEAR
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, clearRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Clear(interp, num_modulefiles, modulefile_list);
/**
** --- module UPDATE
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, updateRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Update(interp, num_modulefiles, modulefile_list);
/**
** --- module PURGE
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, purgeRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Purge(interp, num_modulefiles, modulefile_list);
/**
** --- module INIT
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, initRE))) {
_TCLCHK(interp);
if (Tcl_RegExpMatch(interp, module_command, "^inita|^ia")) {
/* initadd */
_TCLCHK(interp);
g_flags |= M_LOAD;
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~M_LOAD;
}
if (Tcl_RegExpMatch(interp, module_command, "^initr|^iw")) {
/* initrm */
_TCLCHK(interp);
g_flags |= M_REMOVE;
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~M_REMOVE;
}
if (Tcl_RegExpMatch(interp, module_command, "^initl|^il")) {
/* initlist */
_TCLCHK(interp);
g_flags |= M_DISPLAY;
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~M_DISPLAY;
}
if (Tcl_RegExpMatch(interp, module_command, "^inits|^is")) {
/* initswitch */
_TCLCHK(interp);
g_flags |= M_SWITCH;
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~M_SWITCH;
}
if (Tcl_RegExpMatch(interp, module_command, "^initc|^ic")) {
/* initclear */
_TCLCHK(interp);
g_flags |= M_CLEAR;
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~M_CLEAR;
}
if (Tcl_RegExpMatch(interp, module_command, "^initp|^ip")) {
/*initprepend */
_TCLCHK(interp);
g_flags |= (M_PREPEND | M_LOAD);
return_val =
ModuleCmd_Init(interp, num_modulefiles,
modulefile_list);
g_flags &= ~(M_PREPEND | M_LOAD);
}
/**
** --- module USE
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, useRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Use(interp, num_modulefiles, modulefile_list);
g_retval = return_val;
/**
** --- module UNUSE
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, unuseRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_UnUse(interp, num_modulefiles, modulefile_list);
/**
** --- module REFRESH
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, refreshRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Refresh(interp, num_modulefiles, modulefile_list);
/**
** --- module HELP
**/
} else if ((_MTCH Tcl_RegExpMatch(interp, module_command, helpRE))) {
_TCLCHK(interp);
return_val =
ModuleCmd_Help(interp, num_modulefiles, modulefile_list);
}
/**
** Evaluate the subcommands return value in order to get rid of unrecog-
** nized commands
**/
if (return_val < 0)
if (OK != ErrorLogger(ERR_COMMAND, LOC, module_command, NULL))
return (TCL_ERROR); /** ------ EXIT (FAILURE) -----> **/
/**
** Clean up from recursion
**/
g_flags = store_flags;
if (store_curmodule)
g_current_module = store_curmodule;
module_command = save_module_command;
/**
** Return on success
**/
return (return_val);
} /** End of 'cmdModule' **/
/*++++
** ** Function-Header ***************************************************** **
** **
** Function: Read_Modulefile **
** **
** Description: Check the passed filename for to be a valid module **
** and execute the according command file **
** **
** First Edition: 1991/10/23 **
** **
** Parameters: Tcl_Interp *interp According Tcl interp.**
** char *filename **
** **
** Result: int TCL_OK Successful completion **
** TCL_BREAK break command **
** TCL_ERROR Any error **
** **
** Attached Globals: **
** **
** ************************************************************************ **
++++*/
int Read_Modulefile( Tcl_Interp *interp,
char *filename)
{
int result;
/**
** Parameter check. A valid filename is to be given.
**/
if( !filename) {
if( OK != ErrorLogger( ERR_PARAM, LOC, "filename", NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
/**
** Check for the module 'magic cookie'
** Trust stdin as a valid module file ...
**/
if( !strcmp( filename, _fil_stdin) && !check_magic( filename,
MODULES_MAGIC_COOKIE, MODULES_MAGIC_COOKIE_LENGTH)) {
if( OK != ErrorLogger( ERR_MAGIC, LOC, filename, NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
/**
** Now do execute that module file and evaluate the result of the
** latest executed command
**/
result = Execute_TclFile(interp, filename);
/**
** Return the result as derivered from the module file execution
**/
return( result);
} /** End of 'Read_Modulefile' **/
/*++++
** ** Function-Header ***************************************************** **
** **
** Function: Execute_TclFile **
** **
** Description: Read in and execute all commands concerning the Tcl **
** file passed as parameter **
** **
** First Edition: 1991/10/23 **
** **
** Parameters: Tcl_Interp *interp According Tcl interp.**
** char *filename **
** **
** Result: int TCL_OK Successful completion **
** TCL_ERROR Any error **
** **
** Attached Globals: line Input read buffer **
** **
** ************************************************************************ **
++++*/
int Execute_TclFile( Tcl_Interp *interp,
char *filename)
{
FILE *infile;
int gotPartial = 0;
int result = 0;
EM_RetVal em_result = EM_OK;
char *cmd;
Tcl_DString cmdbuf;
/**
** If there isn't a line buffer allocated so far, do it now
**/
if( !line ) {
if(!(line = (char*) module_malloc(LINELENGTH * sizeof(char)))) {
if( OK != ErrorLogger( ERR_ALLOC, LOC, NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
}
/**
** If we're supposed to be interpreting from stdin, set infile
** equal to stdin, otherwise, open the file and interpret
**/
if( !strcmp( filename, _fil_stdin)) {
infile = stdin;
} else {
if(!(infile = fopen( filename, "r"))) {
if( OK != ErrorLogger( ERR_OPEN, LOC, filename,
_(em_reading), NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
}
/**
** Allow access to which file is being loaded.
**/
linenum = 0;
Tcl_SetVar( interp, "ModulesCurrentModulefile", filename, 0);
Tcl_DStringInit( &cmdbuf);
while( 1) {
linenum++;
if(!fgets(line, LINELENGTH, infile)) {
if( !gotPartial) {
break; /** while **/
}
line[0] = '\0';
}
/**
** Put the whole command on the command buffer
**/
cmd = Tcl_DStringAppend( &cmdbuf, line, (-1));
if( line[0] != 0 && !Tcl_CommandComplete(cmd)) {
gotPartial++;
continue;
}
/**
** Now evaluate the command and react on its result
** Reinitialize the command buffer
**/
result = Tcl_Eval( interp, cmd);
if( EM_ERROR == (em_result = ReturnValue(interp, result))) {
ErrorLogger( ERR_EXEC, LOC, cmd, NULL);
}
Tcl_DStringTrunc( &cmdbuf, 0);
switch( result) {
case TCL_OK: gotPartial = 0;
continue; /** while **/
case TCL_ERROR: Tcl_SetErrorLine(interp,linenum - 1 - gotPartial
+ Tcl_GetErrorLine(interp));
/* FALLTHROUGH */
case TCL_LEVEL0_RETURN:
break; /** switch **/
}
/**
** If the while loop hasn't been continued so far, it is to be broken
** now
**/
break; /** while **/
} /** while **/
/**
** Free up what has been used, close the input file and return the result
** of the last command to the caller
**/
Tcl_DStringFree( &cmdbuf);
if( EOF == fclose( infile))
if( OK != ErrorLogger( ERR_CLOSE, LOC, filename, NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
return( result);
} /** End of 'Execute_TclFile' **/
/*++++
** ** Function-Header ***************************************************** **
** **
** Function: CallModuleProcedure **
** **
** Description: Call a Tcl Procedure **
** Executes the passed modulefile (conditionally hidden)**
** and then evaluates the passed Tcl procedure **
** **
** First Edition: 1991/10/23 **
** **
** Parameters: Tcl_Interp *interp According Tcl interp.**
** Tcl_DString *cmdptr Buffer fot the Tcl **
** command **
** char *modulefile According module file**
** char *procname Name of the Tcl Proc.**
** int suppress_output Controlls redirect.**
** of stdout and stderr **
** **
** Result: int TCL_OK Successful completion **
** TCL_ERROR Any error **
** **
** Attached Globals: - **
** **
** ************************************************************************ **
++++*/
int CallModuleProcedure( Tcl_Interp *interp,
Tcl_DString *cmdptr,
char *modulefile,
char *procname,
int suppress_output)
{
char cmdline[ LINELENGTH];
char *cmd;
int result;
int saved_stdout = 0, saved_stderr = 0, devnull;
/**
** Must send stdout and stderr to /dev/null until the
** ModulesHelp procedure is called.
**/
if( suppress_output) {
if( 0 > (devnull = open( _fil_devnull, O_RDWR))) {
if( OK != ErrorLogger( ERR_OPEN, LOC, _fil_devnull,
_(em_read_write), NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
/**
** Close STDOUT and reopen it as /dev/null
**/
if( -1 == ( saved_stdout = dup( fileno(stdout))))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_stdout, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == close( fileno(stdout)))
if( OK != ErrorLogger( ERR_CLOSE, LOC, _fil_stdout, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == dup( devnull))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_devnull, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
/**
** Close STDERR and reopen it as /dev/null
**/
if( -1 == ( saved_stderr = dup( fileno(stderr))))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_stderr, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == close( fileno(stderr)))
if( OK != ErrorLogger( ERR_CLOSE, LOC, _fil_stderr, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == dup( devnull))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_devnull, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
}
/**
** Read the passed module file
**/
Read_Modulefile( interp, modulefile);
/**
** Reinstall stdout and stderr
**/
if( suppress_output) {
if( EOF == fflush( stdout))
if( OK != ErrorLogger( ERR_FLUSH, LOC, _fil_stdout, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( EOF == fflush( stderr))
if( OK != ErrorLogger( ERR_FLUSH, LOC, _fil_stderr, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
/**
** Reinstall STDOUT with merging it to SDTDERR
**/
if( -1 == close( fileno(stdout)))
if( OK != ErrorLogger( ERR_CLOSE, LOC, _fil_stdout, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == dup( saved_stderr))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_stdout, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
/**
** Reinstall STDERR
**/
if( -1 == close( fileno(stderr)))
if( OK != ErrorLogger( ERR_CLOSE, LOC, _fil_stderr, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
if( -1 == dup( saved_stderr))
if( OK != ErrorLogger( ERR_DUP, LOC, _fil_stderr, NULL))
return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/
}
/**
** Now evaluate the Tcl Procedure
**/
/* sprintf( cmdline, "%s\n", procname); */
strcpy( cmdline, procname);
strcat( cmdline, "\n");
cmd = Tcl_DStringAppend( cmdptr, cmdline, (-1));
result = Tcl_Eval( interp, cmd);
Tcl_DStringTrunc( cmdptr, 0);
return( result);
} /** End of 'CallModuleProcedure' **/