1981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* 2981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * console.c 3981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 4981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/ 5981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 6981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Licensed under the Apache License, Version 2.0 (the "License"); 7981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * you may not use this file except in compliance with the License. 8981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * You may obtain a copy of the License at 9981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 10981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * http://www.apache.org/licenses/LICENSE-2.0 11981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 12981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Unless required by applicable law or agreed to in writing, software 13981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * distributed under the License is distributed on an "AS IS" BASIS, 14981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * See the License for the specific language governing permissions and 16981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * limitations under the License. 17981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 18981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 19981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**************************************************************************** 20981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* 21981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* MODULE: console.c 22981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* 23981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* PURPOSE: 24981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* 25981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* DESCRIPTION: 26981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* ============ 27981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* 28981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* 29981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt****************************************************************************/ 30981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 31981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* includes */ 32981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************/ 33653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#include <stdio.h> 34981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "cu_osapi.h" 35981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "console.h" 36981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "cu_cmd.h" 37981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 38981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* defines */ 39981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********/ 40981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define INBUF_LENGTH 2100 41981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define MAX_NAME_LEN 64 42981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define MAX_HELP_LEN 40 43981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define MAX_PARM_LEN 20 44981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define ALIAS_LEN 1 45981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 46981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TOKEN_UP ".." 47981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TOKEN_ROOT "/" 48981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TOKEN_BREAK "#" 49981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TOKEN_HELP "?" 50981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TOKEN_DIRHELP "help" 51653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#define TOKEN_QUIT "q1" 52981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 53981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* local types */ 54981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************/ 55981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 56981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef enum 57981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 58981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Dir, 59981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Token 60981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} ConEntry_type_t; 61981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 62981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Token types */ 63981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef enum 64981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 65981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt EmptyToken, 66981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt UpToken, 67981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RootToken, 68981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt BreakToken, 69981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt HelpToken, 70981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt DirHelpToken, 71653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt QuitToken, 72981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt NameToken 73981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} TokenType_t; 74981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 75981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 76981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Monitor token structure */ 77981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct ConEntry_t 78981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 79981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt struct ConEntry_t *next; 80981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 name[MAX_NAME_LEN+1]; /* Entry name */ 81981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 help[MAX_HELP_LEN+1]; /* Help string */ 82981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 alias; /* Alias - always in upper case*/ 83981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_type_t sel; /* Entry selector */ 84981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 85981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt union 86981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 87981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt struct 88981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 89981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt struct ConEntry_t *upper; /* Upper directory */ 90981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt struct ConEntry_t *first; /* First entry */ 91981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } dir; 92981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt struct t_Token 93981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 94981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt FuncToken_t f_tokenFunc; /* Token handler */ 95981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 totalParams; 96981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConParm_t *parm; /* Parameters array with totalParams size */ 97981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 *name; /* Parameter name with totalParams size */ 98981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } token; 99981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } u; 100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} ConEntry_t; 101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Module control block */ 103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct Console_t 104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt THandle hCuCmd; 106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 isDeviceOpen; 108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_mon_root; 110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_cur_dir; 111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 p_inbuf; 112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt volatile S32 stop_UI_Monitor; 113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} Console_t; 114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* local variables */ 116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*******************/ 117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* local fucntions */ 119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*******************/ 120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic VOID Console_allocRoot(Console_t* pConsole); 121653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtint consoleRunScript( char *script_file, THandle hConsole); 122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Remove leading blanks */ 125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic PS8 Console_ltrim(PS8 s) 126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( *s == ' ' || *s == '\t' ) s++; 128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return s; 129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* 132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtMake a preliminary analizis of <name> token. 133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtReturns a token type (Empty, Up, Root, Break, Name) 134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/ 135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TokenType_t Console_analizeToken( PS8 name ) 136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!name[0]) 138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return EmptyToken; 139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_UP ) ) 141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return UpToken; 142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_ROOT ) ) 144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return RootToken; 145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_BREAK ) ) 147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return BreakToken; 148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_HELP ) ) 150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return HelpToken; 151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_DIRHELP ) ) 153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return DirHelpToken; 154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 155653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (!os_strcmp(name, (PS8)TOKEN_QUIT ) ) 156653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return QuitToken; 157653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NameToken; 159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Compare strings case insensitive */ 163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic S32 Console_stricmp( PS8 s1, PS8 s2, U16 len ) 164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 i; 166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; i<len && s1[i] && s2[i]; i++ ) 168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (os_tolower(s1[i]) != os_tolower(s2[i] )) 170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return ( (len - i) * (s1[i] - s2[i]) ); 174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Convert string s to lower case. Return pointer to s */ 177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic PS8 Console_strlwr( PS8 s ) 178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 s0=s; 180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( *s ) 182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *s = (S8)os_tolower(*s ); 184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ++s; 185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return s0; 188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* free the entries tree */ 191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic VOID Console_FreeEntry(ConEntry_t *pEntry) 192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *pEntryTemp,*pEntryTemp1; 194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pEntry->sel == Dir) 196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pEntryTemp = pEntry->u.dir.first; 198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while (pEntryTemp) 200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pEntryTemp1 = pEntryTemp->next; 202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_FreeEntry(pEntryTemp); 203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pEntryTemp = pEntryTemp1; 204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* free the current entry */ 208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(pEntry); 209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Allocate root directory */ 213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic VOID Console_allocRoot(Console_t* pConsole) 214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* The very first call. Allocate root structure */ 216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((pConsole->p_mon_root=(ConEntry_t *)os_MemoryCAlloc(sizeof( ConEntry_t ), 1) ) == NULL) 217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)( "ERROR - Console_allocRoot(): cant allocate root\n") ); 219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcpy((PS8)pConsole->p_mon_root->name, (PS8)("\\") ); 222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_mon_root->sel = Dir; 223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_cur_dir = pConsole->p_mon_root; 224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Display current directory */ 227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic VOID Console_displayDir(Console_t* pConsole) 228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 out_buf[512]; 230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_dir = pConsole->p_cur_dir; 232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_sprintf((PS8)out_buf, (PS8)("%s%s> "), (PS8)(p_dir==pConsole->p_mon_root)? (PS8)("") : (PS8)(".../"), (PS8)p_dir->name ); 234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_dir->u.dir.first; 235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( (os_strlen(out_buf) + os_strlen(p_token->name) + 2)>= sizeof(out_buf) ) 238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, ( (PS8)"ERROR - Console_displayDir(): buffer too small....\n") ); 240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcat(out_buf, p_token->name ); 243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( p_token->sel == Dir ) 244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcat((PS8)out_buf, (PS8)("/" ) ); 245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token) 247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcat((PS8)out_buf, (PS8)(", ") ); 248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("%s\n"), (PS8)out_buf ); 251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* 255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtCut the first U16 from <p_inbuf>. 256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtReturn the U16 in <name> and updated <p_inbuf> 257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/ 258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TokenType_t Console_getWord(Console_t* pConsole, PS8 name, U16 len ) 259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 i=0; 261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TokenType_t tType; 262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); 264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( *pConsole->p_inbuf && *pConsole->p_inbuf!=' ' && i<len ) 266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt name[i++] = *(pConsole->p_inbuf++); 267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (i<len) 269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt name[i] = 0; 270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tType = Console_analizeToken( name ); 272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return tType; 274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TokenType_t Console_getStrParam(Console_t* pConsole, PS8 buf, ConParm_t *param ) 277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TokenType_t tType; 279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U32 i, len = param->hi_val; 280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 end_buf; 281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); 283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( param->flags & CON_PARM_LINE ) 285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcpy(buf, (PS8)pConsole->p_inbuf ); 287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); 288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( *pConsole->p_inbuf == '\"' ) 292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt end_buf = os_strchr(pConsole->p_inbuf+1, '\"' ); 294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( !end_buf ) 295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - invalid string param: '%s'\n"), (PS8)pConsole->p_inbuf ); 297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); 298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return EmptyToken; 299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( (end_buf - pConsole->p_inbuf - 1) > (int)len ) 301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param is too long: '%s'\n"), (PS8)pConsole->p_inbuf ); 303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); 304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return EmptyToken; 305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *end_buf = 0; 307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcpy( buf, (PS8)(pConsole->p_inbuf+1 ) ); 308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = end_buf + 1; 309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; *pConsole->p_inbuf && *pConsole->p_inbuf!=' ' && i<len; i++ ) 313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt buf[i] = *(pConsole->p_inbuf++); 314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt buf[i] = 0; 316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( *pConsole->p_inbuf && *pConsole->p_inbuf != ' ' ) 317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param is too long: '%s'\n"), (PS8)( pConsole->p_inbuf-os_strlen( buf) ) ); 319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); 320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return EmptyToken; 321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tType = Console_analizeToken( buf ); 326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return tType; 328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Returns number of parameters of the given token 331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/ 332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic U16 Console_getNParms( ConEntry_t *p_token ) 333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 i; 335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( !p_token->u.token.parm ) 336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return 0; 337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; 338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (i<p_token->u.token.totalParams) && 339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].name && 340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].name[0]; 341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt i++ ) 342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ; 343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return i; 344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Parse p_inbuf string based on parameter descriptions in <p_token>. 347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtFill parameter values in <p_token>. 348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtReturns the number of parameters filled. 349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTo Do: add a option of one-by-one user input of missing parameters. 350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/ 351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic S32 Console_parseParms(Console_t* pConsole, ConEntry_t *p_token, U16 *pnParms ) 352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 nTotalParms = Console_getNParms( p_token ); 354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 nParms=0; 355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 end_buf = NULL; 356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 parm[INBUF_LENGTH]; 357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 i, print_params = 0; 358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U32 val = 0; 359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 sval = 0; 360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Mark all parameters as don't having an explicit value */ 362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; i<nTotalParms; i++ ) 363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].flags |= CON_PARM_NOVAL; 364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* ----------------- */ 366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); 367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( pConsole->p_inbuf[0] == '!' && pConsole->p_inbuf[1] == '!' ) 368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf += 2; print_params = 1; 370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* ----------------- */ 372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Build a format string */ 374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; i<nTotalParms; i++ ) 375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & (CON_PARM_STRING | CON_PARM_LINE) ) 377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* For a string parameter value is the string address */ 379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and hi_val is the string length */ 380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (Console_getStrParam(pConsole, parm, &p_token->u.token.parm[i] ) != NameToken) 381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( os_strlen( parm) > p_token->u.token.parm[i].hi_val || 383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (p_token->u.token.parm[i].low_val && p_token->u.token.parm[i].low_val > os_strlen( parm) ) ) 384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param '%s' must be %ld..%ld chars\n"), (PS8)p_token->u.token.parm[i].name, 386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val); 387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return FALSE; 388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strcpy((PS8)(char *)p_token->u.token.parm[i].value, (PS8)parm); 390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (Console_getWord(pConsole, parm, MAX_PARM_LEN ) != NameToken) 394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) 397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 398981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt sval = os_strtol( parm, &end_buf, 0 ); 399981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt val = os_strtoul( parm, &end_buf, 0 ); 403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( end_buf <= parm ) 405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Check value */ 408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_RANGE) 409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) 411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((sval < (S32)p_token->u.token.parm[i].low_val) || 413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (sval > (S32)p_token->u.token.parm[i].hi_val) ) 414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("%s: %d out of range (%d, %d)\n"), 416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].name, (int)sval, 417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (int)p_token->u.token.parm[i].low_val, (int)p_token->u.token.parm[i].hi_val ); 418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return FALSE; 419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((val < p_token->u.token.parm[i].low_val) || 425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (val > p_token->u.token.parm[i].hi_val) ) 426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR , (PS8)("%s: %ld out of range (%ld, %ld)\n"), 428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].name, (PS8)val, 429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val ); 430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return FALSE; 431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) 436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].value = sval; 437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].value = val; 439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].flags &= ~CON_PARM_NOVAL; 442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ++nParms; 443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Process default values */ 446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( ; i<nTotalParms; i++ ) 447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((p_token->u.token.parm[i].flags & CON_PARM_DEFVAL) != 0) 449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].flags &= ~CON_PARM_NOVAL; 451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ++nParms; 452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else if (!(p_token->u.token.parm[i].flags & CON_PARM_OPTIONAL) ) 454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Mandatory parameter missing */ 456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return FALSE; 457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( print_params ) 461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 462981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf((S32)CU_MSG_INFO2, (PS8)("Params: %d\n"), nParms ); 463981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for (i=0; i<nParms; i++ ) 464981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("%d: %s - flags:%d"), 466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt i+1, (PS8)p_token->u.token.parm[i].name, 467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm[i].flags); 468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) 470981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("min:%d, max:%d, value:%d "),(PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val, 471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].value); 472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("min:%ld, max:%ld, value:%ld "),(PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val, 474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].value); 475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 476981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("(%#lx)"),(PS8)p_token->u.token.parm[i].value ); 477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( p_token->u.token.parm[i].flags & (CON_PARM_LINE | CON_PARM_STRING )) 479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)(" - '%s'"), (PS8)(char *) p_token->u.token.parm[i].value ); 481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("\n") ); 483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *pnParms = nParms; 487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TRUE; 489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Serach a token by name in the current directory */ 492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic ConEntry_t *Console_searchToken( ConEntry_t *p_dir, PS8 name ) 493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 name_len = (U16)os_strlen( name ); 496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Check alias */ 498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_dir->u.dir.first; 499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->alias && 502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (name_len == ALIAS_LEN) && 503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt !Console_stricmp( p_token->alias, name, ALIAS_LEN ) ) 504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return p_token; 505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Check name */ 509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_dir->u.dir.first; 510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!Console_stricmp( p_token->name, name, name_len ) ) 513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 515981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return p_token; 518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Display help for each entry in the current directory */ 522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtVOID Console_dirHelp(Console_t* pConsole) 523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 print_str[80]; 526981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 527981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = pConsole->p_cur_dir->u.dir.first; 528981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 529981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->sel == Dir) 532981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_sprintf( print_str, (PS8)"%s: directory\n", (PS8)p_token->name ); 533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_sprintf( print_str, (PS8)("%s(%d parms): %s\n"), 535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->name, Console_getNParms(p_token), p_token->help ); 536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)print_str ); 537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("Type ? <name> for command help, \"/\"-root, \"..\"-upper\n") ); 541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Display help a token */ 545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic VOID Console_displayHelp(Console_t* pConsole, ConEntry_t *p_token ) 546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 bra, ket; 548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 nTotalParms = Console_getNParms( p_token ); 549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 i; 550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 551981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 552981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("%s: %s "), (PS8)p_token->help, (PS8)p_token->name ); 553981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for( i=0; i<nTotalParms; i++ ) 554981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_OPTIONAL) 556981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 557981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt bra = '['; ket=']'; 558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 559981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 560981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 561981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt bra = '<'; ket='>'; 562981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 563981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("%c%s"), bra, (PS8)p_token->u.token.parm[i].name ); 564981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_DEFVAL) 565981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("=%lu"), (PS8)p_token->u.token.parm[i].value); 567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.parm[i].flags & CON_PARM_RANGE) 569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)(p_token->u.token.parm[i].flags & CON_PARM_SIGN) ? (PS8)(" (%d..%d%s)") : (PS8)(" (%lu..%lu%s)"), 571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].low_val, 572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->u.token.parm[i].hi_val, 573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)(p_token->u.token.parm[i].flags & (CON_PARM_STRING | CON_PARM_LINE)) ? (PS8)(" chars") : (PS8)("") ); 574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("%c \n"),ket ); 577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Choose unique alias for <name> in <p_dir> */ 581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Currently only single-character aliases are supported */ 582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic S32 Console_chooseAlias( ConEntry_t *p_dir, ConEntry_t *p_new_token ) 583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 i; 586981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 c; 587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 new_alias = NULL; 588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* find alias given from user */ 590981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for(i=0; p_new_token->name[i]; i++ ) 591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( os_isupper( p_new_token->name[i]) ) 593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt new_alias = &p_new_token->name[i]; 595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_strlwr( p_new_token->name ); 600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( new_alias ) 602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_dir->u.dir.first; 604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->alias && (os_tolower(*p_token->alias ) == *new_alias) ) 608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("Error - duplicated alias '%c' in <%s> and <%s>**\n"), *new_alias, 610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (PS8)p_token->name, (PS8)p_new_token->name ); 611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return 0; 612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *new_alias = (S8)os_toupper(*new_alias); 616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_new_token->alias = new_alias; 617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return 1; 618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt i = 0; 621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_new_token->name[i] ) 622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt c = p_new_token->name[i]; 624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_dir->u.dir.first; 625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_token ) 627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->alias && 629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (os_tolower(*p_token->alias ) == c) ) 630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = p_token->next; 632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token) 634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ++i; 635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_new_token->name[i] = (S8)os_toupper( c ); 638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_new_token->alias = &p_new_token->name[i]; 639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return 1; 643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Parse the given input string and exit. 646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtAll commands in the input string are executed one by one. 647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/ 648653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtstatic U8 Console_ParseString(Console_t* pConsole, PS8 input_string ) 649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 name[MAX_NAME_LEN]; 652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TokenType_t tType; 653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 nParms; 654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!pConsole->p_mon_root) 656653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return 1; 657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(!pConsole->isDeviceOpen) 659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_GetDeviceStatus(pConsole); 661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(!pConsole->isDeviceOpen) 662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - Console_ParseString - Device isn't loaded !!!\n") ); 664653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return 1; 665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( input_string[os_strlen( input_string)-1] == '\n' ) 669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 670981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt PS8 s = &input_string[os_strlen( input_string)-1]; 671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *s = 0; 672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = input_string; 674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->stop_UI_Monitor = FALSE; 675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Interpret empty string as "display directory" */ 677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( pConsole->p_inbuf && !*pConsole->p_inbuf ) 678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while(!pConsole->stop_UI_Monitor && pConsole->p_inbuf && *pConsole->p_inbuf) 681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tType = Console_getWord(pConsole, name, MAX_NAME_LEN ); 683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt switch( tType ) 684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case NameToken: 687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token = Console_searchToken( pConsole->p_cur_dir, name ); 688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token == NULL) 689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("**Error: '%s'**\n"),name); 691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = NULL; 692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else if (p_token->sel == Dir) 694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_cur_dir = p_token; 696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { /* Function token */ 700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!Console_parseParms(pConsole, p_token, &nParms )) 701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayHelp(pConsole, p_token ); 703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.f_tokenFunc(pConsole->hCuCmd, p_token->u.token.parm, nParms ); 707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case UpToken: /* Go to upper directory */ 712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pConsole->p_cur_dir->u.dir.upper) 713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_cur_dir = pConsole->p_cur_dir->u.dir.upper; 714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case RootToken: /* Go to the root directory */ 718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pConsole->p_cur_dir->u.dir.upper) 719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_cur_dir = pConsole->p_mon_root; 720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case HelpToken: /* Display help */ 724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (( Console_getWord(pConsole, name, MAX_NAME_LEN ) == NameToken ) && 725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ((p_token = Console_searchToken( pConsole->p_cur_dir, name )) != NULL ) && 726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (p_token->sel == Token) ) 727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayHelp(pConsole, p_token); 728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_dirHelp(pConsole); 730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case DirHelpToken: 733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_INFO2, (PS8)("Type ? <name> for command help, \"/\"-root, \"..\"-upper\n") ); 735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case BreakToken: /* Clear buffer */ 738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->p_inbuf = NULL; 739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 741653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt case QuitToken: /* Go to upper directory */ 742653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return 1; 743653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case EmptyToken: 745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 749653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return 0; 750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* functions */ 753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*************/ 754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTHandle Console_Create(const PS8 device_name, S32 BypassSupplicant, PS8 pSupplIfFile) 756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)os_MemoryCAlloc(sizeof(Console_t), sizeof(U8)); 758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pConsole == NULL) 759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("Error - Console_Create - cant allocate control block\n") ); 761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->hCuCmd = CuCmd_Create(device_name, pConsole, BypassSupplicant, pSupplIfFile); 765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pConsole->hCuCmd == NULL) 766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_Destroy(pConsole); 768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_allocRoot(pConsole); 772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->isDeviceOpen = FALSE; 774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return pConsole; 776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtVOID Console_Destroy(THandle hConsole) 779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pConsole->hCuCmd) 783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt CuCmd_Destroy(pConsole->hCuCmd); 785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pConsole->p_mon_root) 787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_FreeEntry(pConsole->p_mon_root); 789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(pConsole); 791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtVOID Console_Stop(THandle hConsole) 794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ((Console_t*)hConsole)->stop_UI_Monitor = TRUE; 796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Monitor driver */ 799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtVOID Console_Start(THandle hConsole) 800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S8 inbuf[INBUF_LENGTH]; 803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt S32 res; 804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!pConsole->p_mon_root) 806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->stop_UI_Monitor = FALSE; 809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_displayDir(pConsole); 810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while(!pConsole->stop_UI_Monitor) 812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get input string */ 814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt res = os_getInputString(inbuf, sizeof(inbuf)); 815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (res == FALSE) 816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pConsole->stop_UI_Monitor) 818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(res == OS_GETINPUTSTRING_CONTINUE) 828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* change to NULL terminated strings */ 831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( inbuf[os_strlen(inbuf)-1] == '\n' ) 832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt inbuf[os_strlen(inbuf)-1] = 0; 833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* parse the string */ 835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_ParseString(pConsole, inbuf); 836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtVOID Console_GetDeviceStatus(THandle hConsole) 841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(OK == CuCmd_GetDeviceStatus(pConsole->hCuCmd)) 845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pConsole->isDeviceOpen = TRUE; 847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*************************************************************** 852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Function : consoleAddDirExt 854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Description: Add subdirectory 856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Parameters: p_root - root directory handle (might be NULL) 858981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt name - directory name 859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 860981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Output: the new created directory handle 861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt =NULL - failure 862981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************/ 863981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTHandle Console_AddDirExt(THandle hConsole, 864981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt THandle hRoot, /* Upper directory handle. NULL=root */ 865981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt const PS8 name, /* New directory name */ 866981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt const PS8 desc ) /* Optional dir description */ 867981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_root = (ConEntry_t *)hRoot; 870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_dir; 871981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t **p_e; 872981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 873981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!p_root) 874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_root = pConsole->p_mon_root; 875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(!( p_root && (p_root->sel == Dir))) 877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( (p_dir=(ConEntry_t *)os_MemoryAlloc(sizeof( ConEntry_t )) ) == NULL) 880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_memset( p_dir, 0, sizeof( ConEntry_t ) ); 883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strncpy( p_dir->name, name, MAX_NAME_LEN ); 884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strncpy( p_dir->help, desc, MAX_HELP_LEN ); 885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_dir->sel = Dir; 886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_chooseAlias( p_root, p_dir ); 888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Add new directory to the root's list */ 890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_dir->u.dir.upper = p_root; 891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_e = &(p_root->u.dir.first); 892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while (*p_e) 893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_e = &((*p_e)->next); 894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *p_e = p_dir; 895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return p_dir; 897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*************************************************************** 900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Function : consoleAddToken 902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Description: Add token 904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Parameters: p_dir - directory handle (might be NULL=root) 906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt name - token name 907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt help - help string 908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_func - token handler 909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_parms- array of parameter descriptions. 910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Must be terminated with {0}. 911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Each parm descriptor is a struct 912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { "myname", - name 913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 10, - low value 914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 20, - high value 915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 0 } - default value =-1 no default 916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt or address for string parameter 917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Output: E_OK - OK 919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt !=0 - error 920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt***************************************************************/ 921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtconsoleErr Console_AddToken( THandle hConsole, 922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt THandle hDir, 923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt const PS8 name, 924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt const PS8 help, 925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt FuncToken_t p_func, 926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConParm_t p_parms[] ) 927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_dir = (ConEntry_t *)hDir; 930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t *p_token; 931981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConEntry_t **p_e; 932981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt U16 i; 933981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 934981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!pConsole->p_mon_root) 935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_allocRoot(pConsole); 936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!p_dir) 938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_dir = pConsole->p_mon_root; 939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 940981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(!( p_dir && (p_dir->sel == Dir))) 941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_ERROR; 942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 943981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 944981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Initialize token structure */ 945981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if((p_token = (ConEntry_t *)os_MemoryCAlloc(1,sizeof(ConEntry_t))) == NULL) 946981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 947981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** no memory **\n") ); 948981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_NOMEMORY; 949981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 950981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 951981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 952981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Copy name */ 953981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strncpy( p_token->name, name, MAX_NAME_LEN ); 954981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strncpy( p_token->help, help, MAX_HELP_LEN ); 955981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->sel = Token; 956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.f_tokenFunc = p_func; 957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.totalParams = 0; 958981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Convert name to lower case and choose alias */ 960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt Console_chooseAlias( p_dir, p_token ); 961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Copy parameters */ 963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( p_parms ) 964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConParm_t *p_tmpParms = p_parms; 966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* find the number of params */ 968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while( p_tmpParms->name && p_tmpParms->name[0] ) 969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.totalParams++; 971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_tmpParms++; 972981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* allocate the parameters info */ 974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.parm = (ConParm_t *)os_MemoryAlloc(p_token->u.token.totalParams * sizeof(ConParm_t)); 975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.name = (PS8*)os_MemoryAlloc(p_token->u.token.totalParams * sizeof(PS8)); 976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((p_token->u.token.parm == NULL) || (p_token->u.token.name == NULL)) 977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** no memory for params\n") ); 979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token); 980981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_NOMEMORY; 981981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 982981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for (i=0; i < p_token->u.token.totalParams; i++) 983981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 984981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ConParm_t *p_token_parm = &p_token->u.token.parm[i]; 985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* String parameter must have an address */ 987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(p_parms->flags & (CON_PARM_STRING | CON_PARM_LINE)) 988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ( p_parms->hi_val >= INBUF_LENGTH ) 990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** buffer too big: %s/%s\n"), p_dir->name, name); 992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.parm); 993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.name); 994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token); 995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_NOMEMORY; 996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_parms->hi_val == 0 || (p_parms->flags & CON_PARM_RANGE) ) 999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 1000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** Bad string param definition: %s/%s\n"), p_dir->name, name ); 1001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.parm); 1002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.name); 1003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token); 1004981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_BADPARM; 1005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 1006981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_parms->value = (U32)os_MemoryCAlloc(1,p_parms->hi_val+1); 1007981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( !p_parms->value ) 1008981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 1009981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** No memory: %s/%s (max.size=%ld)\n"), p_dir->name, name, p_parms->hi_val ); 1010981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.parm); 1011981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.name); 1012981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token); 1013981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_NOMEMORY; 1014981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 1015981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 1016981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 1017981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Copy parameter */ 1018981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *p_token_parm = *p_parms; 1019981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( p_token_parm->hi_val || p_token_parm->low_val ) 1020981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token_parm->flags |= CON_PARM_RANGE; 1021981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 1022981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token->u.token.name[i] = os_MemoryAlloc(os_strlen(p_parms->name)); 1023981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (p_token->u.token.name[i] == NULL) 1024981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 1025981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("** Error allocate param name\n")); 1026981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.parm); 1027981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token->u.token.name); 1028981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_MemoryFree(p_token); 1029981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_NOMEMORY; 1030981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 1031981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_token_parm->name = (PS8)p_token->u.token.name[i]; 1032981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_strncpy( p_token->u.token.name[i], p_parms->name, os_strlen(p_parms->name) ); 1033981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ++p_parms; 1034981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } /*end of for loop*/ 1035981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 1036981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 1037981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Add token to the directory */ 1038981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_e = &(p_dir->u.dir.first); 1039981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while (*p_e) 1040981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt p_e = &((*p_e)->next); 1041981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *p_e = p_token; 1042981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 1043981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return E_OK; 1044981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 1045981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 1046653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtint consoleRunScript( char *script_file, THandle hConsole) 1047653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt{ 1048653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt FILE *hfile = fopen(script_file, "r" ); 1049653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt U8 status = 0; 1050653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt Console_t* pConsole = (Console_t*)hConsole; 1051653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 1052653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if( hfile ) 1053653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 1054653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt char buf[INBUF_LENGTH]; 1055653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pConsole->stop_UI_Monitor = FALSE; 1056653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 1057653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt while( fgets(buf, sizeof(buf), hfile ) ) 1058653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 1059653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt status = Console_ParseString(pConsole, buf); 1060653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (status == 1) 1061653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return TRUE; 1062653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if( pConsole->stop_UI_Monitor ) 1063653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt break; 1064653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 1065653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 1066653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt fclose(hfile); 1067653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 1068653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt else 1069653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 1070653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt os_error_printf(CU_MSG_ERROR, (PS8)("ERROR in script: %s \n"), (PS8)script_file); 1071653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 1072653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt return pConsole->stop_UI_Monitor; 1073653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt} 1074