Subversion Repositories Vertical

Rev

Rev 11 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 12
Line 1... Line 1...
1
/**
1
/**
2
  * $Id: cmdutil.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ **
2
                Date: 31st March 1993
3
              Author: Kevin Ross (x6143)
3
 
4
 
4
General command line to string or numeric variable reading
5
                      Philips Semiconductors Limited.
5
 
6
 
6
Modified for command line parsing for EPLD multi-fitter program
7
                      Millbrook Industrial Estate, Southampton, SO9 7BH. England.
7
    Mike James 7 Feb 1996
8
 
8
 
9
                Date: 31st March 1993
9
 * $Log: cmdutil.c,v $
10
 
10
 * Revision 1.1.1.1  2003/11/04 23:34:56  mjames
11
General command line to string or numeric variable reading
11
 * Imported into local repositrory
12
 
12
 *
13
Modified for command line parsing for EPLD multi-fitter program
13
 * Revision 1.13  2002/09/09 10:26:56  mjames
14
    Mike James 7 Feb 1996
14
 * Removed set generic range and replaced it with a set generic value command
15
 
15
 * that takes both integers and ranges.
16
 * $Log: cmdutil.c,v $
16
 *
17
 * Revision 1.1.1.1  2003/11/04 23:34:56  mjames
17
 * Revision 1.12  2002/08/14 11:56:13  mjames
18
 * Imported into local repositrory
18
 * Removed NT specific file opening , as recent Cygwin DLL does not
19
 *
19
 * like the code I was using to protect NT from screwing up on opening
20
 * Revision 1.13  2002/09/09 10:26:56  mjames
20
 * read-only files for write (it crashes as the first byte is written)
21
 * Removed set generic range and replaced it with a set generic value command
21
 *
22
 * that takes both integers and ranges.
22
 * Revision 1.11  2002/08/06 12:52:59  mjames
23
 *
23
 * Merge in from latest version
24
 * Revision 1.12  2002/08/14 11:56:13  mjames
24
 *
25
 * Removed NT specific file opening , as recent Cygwin DLL does not
25
 *
26
 * like the code I was using to protect NT from screwing up on opening
26
Revision 1.12  2002/04/10 14:29:10  mjames
27
 * read-only files for write (it crashes as the first byte is written)
27
Moved setting debug level to cmdutil.c
28
 *
28
 
29
 * Revision 1.11  2002/08/06 12:52:59  mjames
29
Amended print external command to list all net names on socket pins
30
 * Merge in from latest version
30
whether routed or not.
31
 *
31
 
32
 *
32
Revision 1.11  2002/03/21 17:14:15  mjames
33
Revision 1.12  2002/04/10 14:29:10  mjames
33
Added search path to vertical file opening for read
34
Moved setting debug level to cmdutil.c
34
 
35
 
35
Revision 1.10  2002/01/16 11:22:42  mjames
36
Amended print external command to list all net names on socket pins
36
database.h header file is read in first as it undefined DLL stuff irrelevant
37
whether routed or not.
37
to HPUX
38
 
38
 
39
Revision 1.11  2002/03/21 17:14:15  mjames
39
Revision 1.9  2001/12/13 22:14:25  mjames
40
Added search path to vertical file opening for read
40
Corrected nested command handlers to allow variable passing without corruption.
41
 
41
 
42
Revision 1.10  2002/01/16 11:22:42  mjames
42
Revision 1.8  2001/11/19 10:41:52  mjames
43
database.h header file is read in first as it undefined DLL stuff irrelevant
43
Merged back DTC release
44
to HPUX
44
 
45
 
45
Revision 1.7.2.1  2001/11/16 15:08:13  mjames
46
Revision 1.9  2001/12/13 22:14:25  mjames
46
Fixed incorrect printf specifier.
47
Corrected nested command handlers to allow variable passing without corruption.
47
Added () barackets to conditional expressions
48
 
48
 
49
Revision 1.8  2001/11/19 10:41:52  mjames
49
Revision 1.7  2001/10/31 22:20:01  mjames
50
Merged back DTC release
50
Tidying up problematical comments caused by CVS
51
 
51
'intelligent' comment guessing
52
Revision 1.7.2.1  2001/11/16 15:08:13  mjames
52
 
53
Fixed incorrect printf specifier.
53
Revision 1.6  2001/08/31 08:19:18  mjames
54
Added () barackets to conditional expressions
54
Added stuff to prevent errors with "sys/stat.h"
55
 
55
 
56
Revision 1.7  2001/10/31 22:20:01  mjames
56
Revision 1.5  2001/06/20 13:43:33  mjames
57
Tidying up problematical comments caused by CVS
57
Corrected logical expression required to open a file : need user rights to open this file
58
'intelligent' comment guessing
58
either 'r' and read rights or 'w' and write rights in trap_fopen call.
59
 
59
 
60
Revision 1.6  2001/08/31 08:19:18  mjames
60
Revision 1.4  2001/06/19 05:19:52  mjames
61
Added stuff to prevent errors with "sys/stat.h"
61
Created a trap_fopen to overcome trying to write to read only files.
62
 
62
If this attempted in NT the file can be opened but not written to.
63
Revision 1.5  2001/06/20 13:43:33  mjames
63
 
64
Corrected logical expression required to open a file : need user rights to open this file
64
Revision 1.3  2001/06/06 12:10:24  mjames
65
either 'r' and read rights or 'w' and write rights in trap_fopen call.
65
Move from HPUX
66
 
66
 
67
Revision 1.4  2001/06/19 05:19:52  mjames
67
Revision 1.2  2001/02/06 22:41:15  mjames
68
Created a trap_fopen to overcome trying to write to read only files.
68
Added correct argument passing for 'read file comp_suffix arg0 arg1 arg2 ...
69
If this attempted in NT the file can be opened but not written to.
69
 
70
 
70
Revision 1.1.1.1  2000/10/19 21:58:35  mjames
71
Revision 1.3  2001/06/06 12:10:24  mjames
71
Mike put it here
72
Move from HPUX
72
 
73
 
73
 
74
Revision 1.2  2001/02/06 22:41:15  mjames
74
 * Revision 1.34  2000/10/04  10:37:03  10:37:03  mjames (Mike James)
75
Added correct argument passing for 'read file comp_suffix arg0 arg1 arg2 ...
75
 * COnversion to Vertical2, supports signals and components
76
 
76
 *
77
Revision 1.1.1.1  2000/10/19 21:58:35  mjames
77
 * Revision 1.34  2000/10/04  10:37:03  10:37:03  mjames (Mike James)
78
Mike put it here
78
 * Part of Release PSAVAT01
79
 
79
 *
80
 
80
 * Revision 1.33  2000/10/02  11:04:10  11:04:10  mjames (Mike James)
81
 * Revision 1.34  2000/10/04  10:37:03  10:37:03  mjames (Mike James)
81
 * new_vhdl
82
 * COnversion to Vertical2, supports signals and components
82
 *
83
 *
83
 * Revision 1.32  2000/09/27  14:42:10  14:42:10  mjames (Mike James)
84
 * Revision 1.34  2000/10/04  10:37:03  10:37:03  mjames (Mike James)
84
 * Part of Release Sep_27_ST_2000
85
 * Part of Release PSAVAT01
85
 *
86
 *
86
 * Revision 1.31  2000/09/21  10:15:40  10:15:40  mjames (Mike James)
87
 * Revision 1.33  2000/10/02  11:04:10  11:04:10  mjames (Mike James)
87
 * Part of Release Sep21Alpha
88
 * new_vhdl
88
 *
89
 *
89
 * Revision 1.30  2000/08/25  09:57:09  09:57:09  mjames (Mike James)
90
 * Revision 1.32  2000/09/27  14:42:10  14:42:10  mjames (Mike James)
90
 * Part of Release Aug25_alpha
91
 * Part of Release Sep_27_ST_2000
91
 *
92
 *
92
 * Revision 1.29  2000/08/16  08:57:26  08:57:26  mjames (Mike James)
93
 * Revision 1.31  2000/09/21  10:15:40  10:15:40  mjames (Mike James)
93
 * Part of Release CD01_Aug2000
94
 * Part of Release Sep21Alpha
94
 *
95
 *
95
 * Revision 1.28  2000/08/14  14:45:07  14:45:07  mjames (Mike James)
96
 * Revision 1.30  2000/08/25  09:57:09  09:57:09  mjames (Mike James)
96
 * Part of Release Aug_14_2000
97
 * Part of Release Aug25_alpha
97
 *
98
 *
98
 * Revision 1.27  2000/08/11  08:30:28  08:30:28  mjames (Mike James)
99
 * Revision 1.29  2000/08/16  08:57:26  08:57:26  mjames (Mike James)
99
 * Part of Release Aug_11_2000
100
 * Part of Release CD01_Aug2000
100
 *
101
 *
101
 * Revision 1.26  2000/08/09  10:31:41  10:31:41  mjames (Mike James)
102
 * Revision 1.28  2000/08/14  14:45:07  14:45:07  mjames (Mike James)
102
 * Part of Release Aug__9_2000
103
 * Part of Release Aug_14_2000
103
 *
104
 *
104
 * Revision 1.25  2000/05/31  11:42:48  11:42:48  mjames (Mike James)
105
 * Revision 1.27  2000/08/11  08:30:28  08:30:28  mjames (Mike James)
105
 * Part of Release May_31_2000
106
 * Part of Release Aug_11_2000
106
 *
107
 *
107
 * Revision 1.24  2000/05/08  17:01:33  17:01:33  mjames (Mike James)
108
 * Revision 1.26  2000/08/09  10:31:41  10:31:41  mjames (Mike James)
108
 * Part of Release May__8_2000
109
 * Part of Release Aug__9_2000
109
 *
110
 *
110
 * Revision 1.23  2000/05/08  16:59:26  16:59:26  mjames (Mike James)
111
 * Revision 1.25  2000/05/31  11:42:48  11:42:48  mjames (Mike James)
111
 * Part of Release May__8_2000
112
 * Part of Release May_31_2000
112
 *
113
 *
113
 * Revision 1.22  2000/05/08  16:57:03  16:57:03  mjames (Mike James)
114
 * Revision 1.24  2000/05/08  17:01:33  17:01:33  mjames (Mike James)
114
 * Part of Release May__8_2000
115
 * Part of Release May__8_2000
115
 *
116
 *
116
 * Revision 1.21  2000/03/08  16:18:44  16:18:44  mjames (Mike James)
117
 * Revision 1.23  2000/05/08  16:59:26  16:59:26  mjames (Mike James)
117
 * New version including PC
118
 * Part of Release May__8_2000
118
 *
119
 *
119
 * Revision 1.18  2000/01/20  15:58:41  15:58:41  mjames (Mike James)
120
 * Revision 1.22  2000/05/08  16:57:03  16:57:03  mjames (Mike James)
120
 * Part of Release R22
121
 * Part of Release May__8_2000
121
 *
122
 *
122
 * Revision 1.17  99/12/22  11:15:22  11:15:22  mjames (Mike James)
123
 * Revision 1.21  2000/03/08  16:18:44  16:18:44  mjames (Mike James)
123
 * Part of Release Dec_22_1999
124
 * New version including PC
124
 *
125
 *
125
 * Revision 1.16  99/06/25  14:34:40  14:34:40  mjames (Mike James)
126
 * Revision 1.18  2000/01/20  15:58:41  15:58:41  mjames (Mike James)
126
 * Added in reference to expression.h, but no changes made
127
 * Part of Release R22
127
 * to the function of acfread yet.
128
 *
128
 *
129
 * Revision 1.17  99/12/22  11:15:22  11:15:22  mjames (Mike James)
129
 * Revision 1.15  99/06/18  09:23:13  09:23:13  mjames (Mike James)
130
 * Part of Release Dec_22_1999
130
 *
131
 *
131
 * Revision 1.14  1999/06/14  10:54:11  mjames
132
 * Revision 1.16  99/06/25  14:34:40  14:34:40  mjames (Mike James)
132
 * *** empty log message ***
133
 * Added in reference to expression.h, but no changes made
133
 *
134
 * to the function of acfread yet.
134
 * Revision 1.14  1999/06/14  10:54:11  mjames
135
 *
135
 * *** empty log message ***
136
 * Revision 1.15  99/06/18  09:23:13  09:23:13  mjames (Mike James)
136
 *
137
 *
137
 * Revision 1.13  98/03/16  11:37:05  11:37:05  mjames (Mike James)
138
 * Revision 1.14  1999/06/14  10:54:11  mjames
138
 * Added LOG_ERROR to logging system . Allows output of serious errors to stderr
139
 * *** empty log message ***
139
 *
140
 *
140
 * Revision 1.12  98/02/11  11:25:47  11:25:47  mjames (Mike James)
141
 * Revision 1.14  1999/06/14  10:54:11  mjames
141
 * Checked in for version 6.2a
142
 * *** empty log message ***
142
 *
143
 *
143
 * Revision 1.11  97/04/23  08:42:47  08:42:47  mjames (Mike James)
144
 * Revision 1.13  98/03/16  11:37:05  11:37:05  mjames (Mike James)
144
 * CHecked in for release rel23041997
145
 * Added LOG_ERROR to logging system . Allows output of serious errors to stderr
145
 *
146
 *
146
 * Revision 1.10  96/07/19  14:38:13  14:38:13  mjames (Mike James)
147
 * Revision 1.12  98/02/11  11:25:47  11:25:47  mjames (Mike James)
147
 * Added list of objects to SET DEL EXT commands
148
 * Checked in for version 6.2a
148
 *
149
 *
149
 * Revision 1.9  1996/07/12  15:52:12  mjames
150
 * Revision 1.11  97/04/23  08:42:47  08:42:47  mjames (Mike James)
150
 * Sorted out things like Alias and Jumpers
151
 * CHecked in for release rel23041997
151
 * Work Correctly
152
 *
152
 * Print COrrectly
153
 * Revision 1.10  96/07/19  14:38:13  14:38:13  mjames (Mike James)
153
 *
154
 * Added list of objects to SET DEL EXT commands
154
 * Revision 1.8  96/05/21  14:14:52  14:14:52  mjames (Mike James)
155
 *
155
 * Altered return codes form utilities to be a more accurate
156
 * Revision 1.9  1996/07/12  15:52:12  mjames
156
 * representation of reality.
157
 * Sorted out things like Alias and Jumpers
157
 *
158
 * Work Correctly
158
 * Revision 1.7  96/03/29  14:46:03  14:46:03  mjames (Mike James)
159
 * Print COrrectly
159
 * Added VHDL netlist writing to the capabilities of ACFREAD
160
 *
160
 *
161
 * Revision 1.8  96/05/21  14:14:52  14:14:52  mjames (Mike James)
161
 * Revision 1.6  96/03/18  13:50:27  13:50:27  mjames (Mike James)
162
 * Altered return codes form utilities to be a more accurate
162
 * Real Revision 2.1
163
 * representation of reality.
163
 *
164
 *
164
 * Revision 1.4  96/02/13  09:13:13  09:13:13  mjames (Mike James)
165
 * Revision 1.7  96/03/29  14:46:03  14:46:03  mjames (Mike James)
165
 * Updated to be version 2.0 with net joining
166
 * Added VHDL netlist writing to the capabilities of ACFREAD
166
 *
167
 *
167
 * Revision 1.3  96/02/08  15:28:12  15:28:12  mjames (Mike James)
168
 * Revision 1.6  96/03/18  13:50:27  13:50:27  mjames (Mike James)
168
 * First release
169
 * Real Revision 2.1
169
 *
170
 *
170
 * Revision 1.2  96/02/07  16:01:23  16:01:23  mjames (Mike James)
171
 * Revision 1.4  96/02/13  09:13:13  09:13:13  mjames (Mike James)
171
 * Added correct RCS header
172
 * Updated to be version 2.0 with net joining
172
 *
173
 *
173
 * Revision 1.1  96/02/07  15:49:47  15:49:47  mjames (Mike James)
174
 * Revision 1.3  96/02/08  15:28:12  15:28:12  mjames (Mike James)
174
 * Initial revision
175
 * First release
175
 *
176
 *
176
**********************************************************************************************************/
177
 * Revision 1.2  96/02/07  16:01:23  16:01:23  mjames (Mike James)
177
 
178
 * Added correct RCS header
178
#include <stdio.h> 
179
 *
179
#include <string.h> 
180
 * Revision 1.1  96/02/07  15:49:47  15:49:47  mjames (Mike James)
180
#include <stdlib.h> 
181
 * Initial revision
181
#include <ctype.h> 
182
 *
182
#include <sys/stat.h>
183
**********************************************************************************************************/
-
 
184
 
-
 
185
#include <stdio.h> 
-
 
186
#include <string.h> 
-
 
187
#include <stdlib.h> 
-
 
188
#include <ctype.h> 
-
 
189
#include <sys/stat.h>
-
 
190
 
183
 
191
#include "vertcl_main.h" 
184
#include "vertcl_main.h" 
192
#include "cmdparse.h" 
185
#include "cmdparse.h" 
193
#include "cmdutil.h" 
186
#include "cmdutil.h" 
194
#include "cmdlog.h" 
187
#include "cmdlog.h" 
195
#include "expression.h"
188
#include "expression.h"
196
#include "generic.h"
189
#include "generic.h"
197
#include "database.h"
190
#include "database.h"
198
#include "lx_support.h"
191
#include "lx_support.h"
199
 
192
 
200
#ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/cmdlib/cmdutil.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $"
193
#ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/cmdlib/cmdutil.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $"
201
 
194
 
202
/***************************************************************/
195
/***************************************************************/
203
/* this routine is used to trap opening read-only files for write */
196
/* this routine is used to trap opening read-only files for write */
204
/* writing files is always into the current directory. Reading uses a search path */
197
/* writing files is always into the current directory. Reading uses a search path */
205
/* #if defined IS_HPUX */
198
/* #if defined IS_HPUX */
206
 
199
 
207
#if 1
200
#if 1
208
#define safe_fopen fopen
201
#define safe_fopen fopen
209
#else 
202
#else 
210
#define safe_fopen nt_fopen 
203
#define safe_fopen nt_fopen 
211
 
204
 
212
/* and then define the NT protection function */
205
/* and then define the NT protection function */
213
FILE * nt_fopen(char * name, char * mode)
206
FILE * nt_fopen(char * name, char * mode)
214
  {
207
  {
215
  struct stat buf;
208
  struct stat buf;
216
  if(ISNULLSTR(name))
209
  if(ISNULLSTR(name))
217
    {
210
    {
218
    return(NULL);
211
    return(NULL);
219
    }
212
    }
220
  stat( name,&buf  );
213
  stat( name,&buf  );
221
  if(level & 16)
214
  if(level & 16)
222
      {
215
      {
223
      printf("stat %08o '%s' '%s'\n",buf.st_mode,name,mode);
216
      printf("stat %08o '%s' '%s'\n",buf.st_mode,name,mode);
224
      }
217
      }
225
/* no file there attempt open anyway */
218
/* no file there attempt open anyway */
226
  if (buf.st_mode == 0)
219
  if (buf.st_mode == 0)
227
    {
220
    {
228
    return (fopen(name,mode));
221
    return (fopen(name,mode));
229
    }
222
    }
230
  if (S_ISREG(buf.st_mode ))
223
  if (S_ISREG(buf.st_mode ))
231
    {
224
    {
232
    if(((mode[0]=='w') && ((buf.st_mode & S_IRWXU)==S_IWUSR)) ||
225
    if(((mode[0]=='w') && ((buf.st_mode & S_IRWXU)==S_IWUSR)) ||
233
       ((mode[0]=='r') && ((buf.st_mode & S_IRWXU)==S_IRUSR)))
226
       ((mode[0]=='r') && ((buf.st_mode & S_IRWXU)==S_IRUSR)))
234
      {
227
      {
235
      return (fopen(name,mode));
228
      return (fopen(name,mode));
236
      }
229
      }
237
    }      
230
    }      
238
  return NULL;
231
  return NULL;
239
  };
232
  };
240
#endif
233
#endif
241
 
234
 
242
/* we only search for 'r' mode files down the search path */
235
/* we only search for 'r' mode files down the search path */
243
/* or if name does not start with '.' or '/' and does not contain ':' on a PC */
236
/* or if name does not start with '.' or '/' and does not contain ':' on a PC */
244
FILE * trap_fopen(char * name, char * mode)
237
FILE * trap_fopen(char * name, char * mode)
245
  {
238
  {
246
  FILE * f;
239
  FILE * f;
247
#if defined HP_UX
240
#if defined HP_UX
248
  if (strcmp("r",mode)!=0 || name[0]=='/' || name[0] == '.'  )
241
  if (strcmp("r",mode)!=0 || name[0]=='/' || name[0] == '.'  )
249
#else
242
#else
250
  if (strcmp("r",mode)!=0 || name[0]=='/' || name[0] == '.' || strchr(name,':') )
243
  if (strcmp("r",mode)!=0 || name[0]=='/' || name[0] == '.' || strchr(name,':') )
251
#endif
244
#endif
252
    {
245
    {
253
    if(level & 16)
246
    if(level & 16)
254
      printf("Trying to open '%s' (no path) mode '%s'\n",name,mode);
247
      printf("Trying to open '%s' (no path) mode '%s'\n",name,mode);
255
    f=  (safe_fopen(name,mode));
248
    f=  (safe_fopen(name,mode));
256
    }
249
    }
257
  else
250
  else
258
    {
251
    {
259
    char * sp;
252
    char * sp;
260
    char pathbuff [MAXIDLEN];
253
    char pathbuff [MAXIDLEN];
261
    char namebuff [MAXIDLEN];
254
    char namebuff [MAXIDLEN];
262
    expand_string( "$(VERTICAL_PATH)" ,pathbuff, 0, NULL) ;
255
    expand_string( "$(VERTICAL_PATH)" ,pathbuff, 0, NULL) ;
263
    f = NULL;
256
    f = NULL;
264
 
257
 
265
    for(sp=pathbuff;(f == NULL) && (sp=strtok(sp,";"))  ;sp=NULL)
258
    for(sp=pathbuff;(f == NULL) && (sp=strtok(sp,";"))  ;sp=NULL)
266
      {
259
      {
267
      sprintf(namebuff,"%s/%s",sp,name); /* make up pathname */
260
      sprintf(namebuff,"%s/%s",sp,name); /* make up pathname */
268
      if(level & 16)
261
      if(level & 16)
269
        printf("Trying to open '%s' mode '%s'\n",namebuff,mode);
262
        printf("Trying to open '%s' mode '%s'\n",namebuff,mode);
270
      f = safe_fopen(namebuff,mode);
263
      f = safe_fopen(namebuff,mode);
271
      }
264
      }
272
    }
265
    }
273
  if(level & 16)
266
  if(level & 16)
274
    {
267
    {
275
    printf("File Pointer returned = %p\n",f);
268
    printf("File Pointer returned = %p\n",f);
276
    }
269
    }
277
  return f;
270
  return f;
278
  };
271
  };
279
 
272
 
280
/*********************************************************************************************************/
273
/*********************************************************************************************************/
281
int ConvertToDecimal (char *Input, long *Output)
274
int ConvertToDecimal (char *Input, long *Output)
282
    {
275
    {
283
    int Base = 10, Stat = OKCMD;
276
    int Base = 10, Stat = OKCMD;
284
    char *CurrentChar, *End;
277
    char *CurrentChar, *End;
285
 
278
 
286
    CurrentChar = Input;
279
    CurrentChar = Input;
287
    while(*CurrentChar && *CurrentChar ==' ')
280
    while(*CurrentChar && *CurrentChar ==' ')
288
      {
281
      {
289
      CurrentChar++;
282
      CurrentChar++;
290
      }
283
      }
291
    if (*CurrentChar == '0')
284
    if (*CurrentChar == '0')
292
        {
285
        {
293
        CurrentChar++;                                 /* Read first character to calculate the base */
286
        CurrentChar++;                                 /* Read first character to calculate the base */
294
        switch(*CurrentChar)
287
        switch(*CurrentChar)
295
            {
288
            {
296
            case '\0' : *Output=0; return (OKCMD);      /* Trap for single digit zero */
289
            case '\0' : *Output=0; return (OKCMD);      /* Trap for single digit zero */
297
            case 'x'  : Base=16; CurrentChar++; break;
290
            case 'x'  : Base=16; CurrentChar++; break;
298
            case 'b'  : Base=2;  CurrentChar++; break;
291
            case 'b'  : Base=2;  CurrentChar++; break;
299
            default   : Base=8;  break;                 /* Default base is octal */
292
            default   : Base=8;  break;                 /* Default base is octal */
300
            }
293
            }
301
        }
294
        }
302
    else
295
    else
303
       {
296
       {
304
       if (isdigit(*CurrentChar))
297
       if (isdigit(*CurrentChar))
305
         {
298
         {
306
         Base=10;
299
         Base=10;
307
         }
300
         }
308
       else
301
       else
309
         {
302
         {
310
         Stat =FAILED;
303
         Stat =FAILED;
311
         }
304
         }
312
        }
305
        }
313
     if(Stat==OKCMD)
306
     if(Stat==OKCMD)
314
       {
307
       {
315
       *Output = strtol(CurrentChar, &End, Base);
308
       *Output = strtol(CurrentChar, &End, Base);
316
       }
309
       }
317
    if (*End != 0 )
310
    if (*End != 0 )
318
      {
311
      {
319
      Stat = FAILED;
312
      Stat = FAILED;
320
      }
313
      }
321
    return(Stat);
314
    return(Stat);
322
    }
315
    }
323
 
316
 
324
 
317
 
325
void set_debug_level(int lev)
318
void set_debug_level(int lev)
326
  {
319
  {
327
  level = lev;
320
  level = lev;
328
  }
321
  }
329
 
322