tw_cli_page.c.svn-base
资源名称:cli.rar [点击查看]
上传用户:hujq123
上传日期:2016-04-10
资源大小:153k
文件大小:4k
源码类别:
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_page.c
- *
- * brief -
- *
- */
- /*-----------------------------------------------------------*
- *
- * %version: 3 %
- * instance: DS_6
- * %date_created: Fri Feb 21 08:04:40 2003 %
- *
- *###########################################################
- */
- /****************************************************************************
- *
- * Filename : tw_cli_page.c
- * Purpose : CLI command objects and functions to support PAGE commands.
- *
- *
- *****************************************************************************/
- #include <stdio.h>
- #include <stdarg.h>
- #include <string.h>
- #include <tw_cli.h>
- /*** 2nd level CLI Command Option - page "length"
- ***/
- static int CliCoVoproc_PageLength(Cli_cmdSession_t *pSess,
- char *CmdStr, int Ptr);
- Cli_CmdStruct_t CliCo_PageLength =
- {
- "length",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "set the length of a screen page",
- NULL,
- NULL,
- CliCoVoproc_PageLength
- };
- /*** 2nd level CLI Command Option - page "off"
- ***/
- static int CliCoProc_PageOff(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- Cli_CmdStruct_t CliCo_PageOff =
- {
- "off",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "disable screen paging",
- NULL,
- CliCoProc_PageOff,
- NULL
- };
- /*** 2nd level CLI Command Option - page "on"
- ***/
- static int CliCoProc_PageOn(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- Cli_CmdStruct_t CliCo_PageOn =
- {
- "on",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "enable screen paging",
- NULL,
- CliCoProc_PageOn,
- NULL
- };
- /*** 1st level CLI Command Option - "page"
- ***/
- Cli_CmdStruct_t *CliRcoOptionList_Page[] =
- {
- &CliCo_PageLength,
- &CliCo_PageOff,
- &CliCo_PageOn,
- NULL
- };
- Cli_CmdStruct_t CliRco_Page =
- {
- "page",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- CliRcoOptionList_Page,
- "screen paging control command",
- NULL,
- NULL,
- NULL
- };
- /*****************************************************************************
- * int CliCoVoproc_PageLength(Cli_cmdSession_t *pSess, char *cmdStr, int ptr)
- * int CliCoProc_PageOff(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- * int CliCoProc_PageOn(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- *
- * Description :
- * These are very simple commands to control the screen paging mechanism.
- * "page length X" sets the screen length to X or CLI_MINIMAL_SCREEN_LENGTH,
- * whichever is larger. "page on" and "page off" turns on and off screen
- * paging.
- *
- * Arguments :
- * Standard prarameters.
- *
- * Returns :
- * 0 if OK, -1 if bad.
- *
- * History
- * who when why
- * KBL 11/19/99 created
- *
- *****************************************************************************/
- static int CliCoVoproc_PageLength(Cli_cmdSession_t *pSess,
- char *CmdStr,
- int Ptr)
- {
- int OldPageLen, NewPageLen;
- if (sscanf(CmdStr + Ptr, "%d", &NewPageLen) != 1)
- {
- goto BadParamError;
- }
- Cli_GetScrollPauseStatus(pSess, &OldPageLen);
- Cli_SetPageLength(pSess, NewPageLen);
- Cli_GetScrollPauseStatus(pSess, &NewPageLen);
- Cli_Printf(pSess, "** Screen page size change from %d to %dn",
- OldPageLen, NewPageLen);
- goto Done;
- BadParamError:
- Cli_Printf(pSess, badParamStr);
- Done :
- return 0;
- }
- static int CliCoProc_PageOff(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- {
- Cli_DisableScrollPause(pSess);
- return 0;
- }
- static int CliCoProc_PageOn(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- {
- Cli_EnableScrollPause(pSess);
- return 0;
- }