tw_cli_show.c.svn-base
资源名称:cli.rar [点击查看]
上传用户:hujq123
上传日期:2016-04-10
资源大小:153k
文件大小:5k
源码类别:
Telnet服务器
开发平台:
Unix_Linux
- /*
- * Copyright (C) 2002 Koninklijke Philips Electronics N.V.,
- * All Rights Reserved.
- *
- * This source code and any compilation or derivative thereof is the
- * proprietary information of Koninklijke Philips Electronics N.V.
- * and is confidential in nature.
- * Under no circumstances is this software to be exposed to or placed
- * under an Open Source License of any type without the expressed
- * written permission of Koninklijke Philips Electronics N.V.
- *
- *###########################################################
- */
- /*!
- * file tw_cli_show.c
- *
- * brief -
- *
- */
- /*-----------------------------------------------------------*
- *
- * %version: 4 %
- * instance: DS_6
- * %date_created: Fri Feb 21 08:04:42 2003 %
- *
- *###########################################################
- */
- /****************************************************************************
- *
- * Filename : tw_cli_octopus.c
- * Purpose : Cli command objects and functions to support SHOW commands.
- *
- *
- *****************************************************************************/
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
- #include <string.h>
- #include <tmtypes.h>
- #include <tw_cli.h>
- #include <sys_conf.h>
- static int CliCoProc_Unavailable(Cli_cmdSession_t *pSess,
- char *CmdStr, int Ptr);
- /**************** *** Definition of CLI Command Objects *** ***************/
- /*** 2nd level CLI Command Option - show "system"
- ***/
- static int CliCoProc_ShowSystem(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- Cli_CmdStruct_t CliCo_ShowSystem =
- {
- "system",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "display system info",
- NULL,
- CliCoProc_ShowSystem,
- NULL
- };
- /*** 2nd level CLI Command Option - show "sock"
- ***/
- extern int CliCoProc_ShowSock(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- Cli_CmdStruct_t CliCo_ShowSock =
- {
- "sock",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "display socket list from fusion",
- NULL,
- #if defined(FUSION_TCPIP)
- CliCoProc_ShowSock,
- #else
- CliCoProc_Unavailable,
- #endif
- NULL
- };
- /*** Externally defined 2nd level CLI "show" commands
- ***/
- extern Cli_CmdStruct_t CliCo_ShowIp;
- /*** 1st level CLI Command Option - show
- ***/
- Cli_CmdStruct_t *CliRcoOptionList_Show[] =
- {
- &CliCo_ShowIp,
- &CliCo_ShowSock,
- &CliCo_ShowSystem,
- NULL
- };
- Cli_CmdStruct_t CliRco_Show =
- {
- "show",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- CliRcoOptionList_Show,
- "display selective info",
- NULL,
- NULL,
- NULL
- };
- /*****************************************************************************
- * int CliCoProc_ShowSystem(Cli_cmdSession_t *pSess, char *cmdStr, int ptr)
- *
- * Description :
- * This is the command processing handler for
- * "show system"
- *
- * Arguments :
- * Standard prarameters.
- *
- * Returns :
- * 0 if OK, -1 if bad.
- *
- * History
- * who when why
- * KBL 7/7/99 created
- *
- *****************************************************************************/
- extern UInt32 Fns_GetSysUpTimeInSecond( void );
- extern UInt32 Fns_GetTTimeInMiniSec( void );
- extern UInt32 Fns_GetClockTick( void );
- int CliCoProc_ShowSystem(Cli_cmdSession_t *pSess, char *cmdStr, int ptr)
- {
- char uptime[128];
- Cli_Printf(pSess, "Version %s built on %s %s by %sn",
- TwVersion_GetName(),
- TwVersion_GetDate(),
- TwVersion_GetTime(),
- TwBuild_GetUser());
- Cli_Printf(pSess, "%sn", TwVersion_GetCopyright()) ;
- TwFlash_PrintHeader((Cli_Printf_t) Cli_Printf, pSess) ;
- #if defined(FUSION_TCPIP)
- //FIXTHIS for non-Fusion
- if (Cli_Printf(pSess, "Router SysUptime(s) = %-10dn",
- Fns_GetSysUpTimeInSecond()) < 0 )
- {
- return -1;
- }
- #endif /* defined(FUSION_TCPIP) */
- SysUpTime(uptime);
- Cli_Printf(pSess, "%s", uptime);
- return 0;
- }
- /*****************************************************************************
- * int CliCoProc_Unavailable(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- *
- * Description :
- * Stub for unavailable feature.
- *
- * Arguments :
- * Standard prarameters.
- *
- * Returns :
- * 0 if OK, -1 if bad.
- *
- * History
- * who when why
- * KBL 2/31/00 created
- *
- *****************************************************************************/
- static int CliCoProc_Unavailable(Cli_cmdSession_t *pSess,
- char *CmdStr, int Ptr)
- {
- Cli_Printf(pSess, "FIXTHIS: Temporarily disabled because it's stack specific...n");
- return 0;
- }