-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmdVerbose.c
154 lines (125 loc) · 4.82 KB
/
cmdVerbose.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
/*****
** ** Module Header ******************************************************* **
** **
** Modules Revision 3.0 **
** Providing a flexible user environment **
** **
** File: cmdVerbose.c **
** First Edition: 1995/12/31 **
** **
** Authors: Jens Hamisch, jens@Strawberry.COM **
** **
** Description: The Tcl module-verbose routine allows switchin ver- **
** bosity on and off during module file execution **
** **
** Exports: cmdModuleVerbose **
** **
** Notes: **
** **
** ************************************************************************ **
****/
/** ** Copyright *********************************************************** **
** **
** Copyright 1991-1994 by John L. Furlan. **
** see LICENSE.GPL, which must be provided, for details **
** **
** ************************************************************************ **/
static char Id[] = "@(#)$Id: 3c6341f3500413e4b144c24a5275b1a8076fe322 $";
static void *UseId[] = { &UseId, Id };
/** ************************************************************************ **/
/** HEADERS **/
/** ************************************************************************ **/
#include "modules_def.h"
/** ************************************************************************ **/
/** LOCAL DATATYPES **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** CONSTANTS **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** MACROS **/
/** ************************************************************************ **/
/** not applicable **/
/** ************************************************************************ **/
/** LOCAL DATA **/
/** ************************************************************************ **/
static char module_name[] = "cmdVerbose.c"; /** File name of this module **/
#if WITH_DEBUGGING_CALLBACK
static char _proc_cmdModuleVerbose[] = "cmdModuleVerbose";
#endif
/** ************************************************************************ **/
/** PROTOTYPES **/
/** ************************************************************************ **/
/** not applicable **/
/*++++
** ** Function-Header ***************************************************** **
** **
** Function: cmdModuleVerbose **
** **
** Description: Callback function for 'verbose' **
** **
** First Edition: 1995/12/31 **
** **
** Parameters: ClientData client_data **
** Tcl_Interp *interp According Tcl interp.**
** int argc Number of arguments **
** char *argv[] Argument array **
** **
** Result: int TCL_OK Successful completion **
** TCL_ERROR Any error **
** **
** Attached Globals: sw_verbose The verbose level selector **
** g_flags These are set up accordingly before **
** this function is called in order to **
** control everything **
** **
** ************************************************************************ **
++++*/
int cmdModuleVerbose( ClientData client_data,
Tcl_Interp *interp,
int argc,
CONST84 char *argv[])
{
#if WITH_DEBUGGING_CALLBACK
ErrorLogger( NO_ERR_START, LOC, _proc_cmdModuleVerbose, NULL);
#endif
char **argptr = (char **) argv;
/**
** Whatis mode?
**/
if( g_flags & (M_WHATIS | M_HELP))
return( TCL_OK); /** ------- EXIT PROCEDURE -------> **/
/**
** Parameter check
**/
if( argc < 2) {
if( OK != ErrorLogger( ERR_USAGE, LOC, argptr[0], " on|off|fmt [args]",
NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
}
/**
** Display mode?
**/
if( g_flags & M_DISPLAY) {
fprintf( stderr, "%s ", argptr[ 0]);
while( --argc)
fprintf( stderr, "%s ", *++argptr);
fprintf( stderr, "\n");
return( TCL_OK); /** ------- EXIT PROCEDURE -------> **/
}
/**
** on or off
**/
if( !strcmp( argptr[1], "on"))
sw_verbose = 1;
else if( !strcmp( argptr[1], "off"))
sw_verbose = 0;
else
Module_Verbosity( --argc, ++argptr);
#if WITH_DEBUGGING_CALLBACK
ErrorLogger( NO_ERR_END, LOC, _proc_cmdModuleVerbose, NULL);
#endif
return( TCL_OK);
} /** End of 'cmdModuleVerbose' **/