亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cmdparser.c

?? vxworks的源代碼
?? C
字號:
/* cmdParser.c - Command line parser routines. *//* Copyright 2000 Wind River Systems, Inc. *//*Modification history--------------------01f,18sep01,wef  merge from wrs.tor2_0.usb1_1-f for veloce, fixed formatting01e,08aug01,dat  Removing warnings01d,31jul01,wef  fix man page generation errors01c,23nov99,rcb  Make KeywordMatch() function public.01b,16aug99,rcb  Add option in CmdParserHelpFunc to display help only for		 a specific command.01a,01jun99,rcb  First.*//*DESCRIPTIONThis file includes a collection of command-line parsing functions which areuseful in the creation of command line utilities, such as bus exercisers.There are three groups of functions defined by this library.  The first isa collection of general string parser functions, such as functions to eliminatewhite space, functions to strip tokens out of a string, and so forth.  The second set of functions drive the actual parsing process.  In order to use this second set of functions, clients must construct a table of CMD_DESCRstructures which define the commands to be recognized by the parser.  A brief example of such a table is shown below..CSCMD_DESCR Commands [] =    {    {"Help", 4, "Help/?", "Displays list of commands.", CmdParserHelpFunc},    {"?",    1, NULL,	  NULL, 	    CmdParserHelpFunc},    {"Exit", 4, "Exit",   "Exits program.",	CmdParserExitFunc},    {NULL,   0, NULL,	  NULL, 	    NULL}    };.CEThe first field is the keyword for the command.  The second field specifiesthe number of characters of the command which must match - allowing the userto enter only a portion of the keyword as a shortcut.  The third and fourthfields are strings giving the command usage and a brief help string.  A NULLin the Help field indicates that the corresponding keyword is a synonym for another command its usage/help should not be shown.  The final field is a pointer to a function of type CMD_EXEC_FUNC which will be invoked if the parser encounters the corresponding command.The third group of functions provide standard CMD_EXEC_FUNCs for certaincommonly used commands, such as CmdParserHelpFunc and CmdParserExitFunc asshown in the preceding example.The caller may pass a generic (pVOID) parameter to the command line parsingfunctions in the second group.	This function is in turn passed to theCMD_EXEC_FUNCs.  In this way, the caller can specify context informationfor the command execution functions.Commands are executed after the user presses [enter].  Multiple commands may be entered on the same command line separated by semicolons (';').  Each command as if it had been entered on a separate line (unless a command terminates with an error, in which case all remaining commands entered on the same line will be ignored).*//* Include files */#include "stdio.h"#include "stdlib.h"#include "string.h"#include "ctype.h"#include "usb/usbPlatform.h"	    /* Basic definitions */#include "usb/tools/cmdParser.h"    /* Our API *//* Constants */#define PAUSE_DISPLAY	    22	    /* Help display pauses every n lines *//*************************************************************************** PromptAndExecCmd - Prompt for a command and execute it.** Displays <pPrompt> to <fout> and prompts for input from <fin>. Then, * parses/executes the command.	<pCmdTable> points to an array of* CMD_DESCR structures defining the command to be recognized by the* parser, and <Param> is a generic parameter passed down to individual * command execution functions.** RETURNS:  RET_OK for normal termination*	RET_ERROR for program failure.*	RET_CONTINUE if execution should continue.*/UINT16 PromptAndExecCmd    (    pVOID param,	/* Generic parameter for exec funcs */    char *pPrompt,	/* Prompt to display */    FILE *fin,		/* Input stream */    FILE *fout, 	/* Output stream */    CMD_DESCR *pCmdTable    /* CMD_DESCR table */    )    {    char cmd [MAX_CMD_LEN]; /* Buffer for input command */    /* Display prompt */    fprintf (fout, pPrompt);    /* Retrieve input */    if (fgets (cmd, sizeof (cmd), fin) != cmd)        return RET_ERROR;    /* Execute input */    return ExecCmd (param, cmd, fin, fout, pCmdTable);    }/*************************************************************************** KeywordMatch - Compare keywords** Compares <s1> and <s2> up to <len> characters, case insensitive.  * Returns 0 if strings are equal.  ** NOTE: This function is equivalent to strnicmp(), but that function is* not available in all libraries.** RETURNS:  0 if s1 and s2 are the same*	-n if s1 < s2*	+n if s1 > s2*/int KeywordMatch    (    char *s1,		    /* string 1 */    char *s2,		    /* string 2 */    int len		/* max length to compare */    )    {    int n = 0;    for (; len > 0; len--)	{	if ((n = toupper (*s1) - toupper (*s2)) != 0 || *s1 == 0 || *s2 == 0) 	    break;	s1++;	s2++;	}    return n;    }/*************************************************************************** ExecCmd - Execute the command line** Parses and executes the commands in the <pCmd> buffer.  I/O - if any -* will go to <fin>/<fout>.  The <pCmd> may contain any number of commands* separated by CMD_SEPARATOR. <pCmdTable> points to an array of* CMD_DESCR structures defining the command to be recognized by the* parser, and <param> is a generic parameter passed down to individual * command execution functions.** RETURNS:  RET_OK for normal termination.*	RET_ERROR for program failure.*	RET_CONTINUE if execution should continue.*/UINT16 ExecCmd    (    pVOID param,	/* Generic parameter for exec funcs */    char *pCmd, 	/* Cmd buffer to be parsed/executed */    FILE *fin,		/* Stream for input */    FILE *fout, 	/* Stream for output */    CMD_DESCR *pCmdTable    /* CMD_DESCR table */    )    {    UINT16 s = RET_CONTINUE;	    /* Execution status */    char keyword [MAX_KEYWORD_LEN]; /* Bfr for command keyword */     CMD_DESCR *pEntry;		/* Pointer to entry in CmdTable */    /* Parse each command on the command line. */    TruncSpace (pCmd);    do	{		/* Retrieve keyword and match against known keywords. */	pCmd = GetNextToken (pCmd, keyword, sizeof (keyword));	if (strlen (keyword) > 0)	    {	    for (pEntry = pCmdTable; 		 pEntry != NULL && pEntry->keyword != NULL;		 pEntry++)		{		if (KeywordMatch (pEntry->keyword, 				  keyword, 				  max (strlen (keyword), 				       (unsigned)pEntry->minMatch))			       == 0)		    {		    /* 		     * We found a matching keyword.  Execute the CMD_EXEC_FUNC		     * for this command. 		     */		    if (pEntry->execFunc == CmdParserHelpFunc)			s = (*pEntry->execFunc) (pCmdTable, &pCmd, fin, fout);		    else			s = (*pEntry->execFunc) (param, &pCmd, fin, fout);		    break;		    }		}	    if (pEntry == NULL || pEntry->keyword == NULL)		{		fprintf (fout, "Unrecognized command: %s\n", keyword);		break;		}	    }	/* Skip over trailing CMD_SEPARATOR characters. */	if (*pCmd != CMD_SEPARATOR)	    while (*pCmd != CMD_SEPARATOR && *pCmd != 0)		pCmd++;	while (*pCmd == CMD_SEPARATOR)	    pCmd++;	}	while (strlen (pCmd) > 0 && s == RET_CONTINUE);    return s;    }/*************************************************************************** SkipSpace - Skips leading white space in a string** Returns a pointer to the first non-white-space character in <pStr>.** RETURNS: Ptr to first non-white-space character in <pStr>*/#define IS_SPACE(c) (isspace ((int) (c)) || ((c) > 0 && (c) < 32))char *SkipSpace     (    char *pStr		/* Input string */    )    {    while (IS_SPACE (*pStr))	pStr++;    return pStr;    }/*************************************************************************** TruncSpace - Truncates string to eliminate trailing whitespace** Trucates <pStr> to eliminate trailing white space.  Returns count* of characters left in <pStr> upon return.** RETURNS: Number of characters in <pStr> after truncation.*/UINT16 TruncSpace     (    char *pStr		/* Input string */    )    {    UINT16 len;    while ((len = strlen (pStr)) > 0 && IS_SPACE (pStr [len - 1]))	pStr [len - 1] = 0;    return len;    }/*************************************************************************** GetNextToken - Retrieves the next token from an input string** Copies the next token from <pStr> to <pToken>.  White space before the* next token is discarded.  Tokens are delimited by white space and by* the command separator, CMD_SEPARATOR.  No more than <tokenLen> - 1* characters from <pStr> will be copied into <pToken>.	<tokenLen> must be* at least one and <pToken> will be NULL terminated upon return.** RETURNS: Pointer into <pStr> following end of copied <pToken>.*/char *GetNextToken     (    char *pStr, 	/* Input string */    char *pToken,	/* Bfr to receive token */    UINT16 tokenLen	/* Max length of Token bfr */    )    {    UINT16 len; 	/* Temporary length counter */    /* Skip leading white space */    pStr = SkipSpace (pStr);    /* Copy next token into Token bfr */    pToken [0] = 0;    while ((len = strlen (pToken)) < tokenLen && 	   *pStr != 0 && 	   !IS_SPACE (*pStr) && 	   *pStr != CMD_SEPARATOR)	{	pToken [len] = *pStr;	pToken [len+1] = 0;	pStr++;	}    return pStr;    }/*************************************************************************** GetHexToken - Retrieves value of hex token** Retrieves the next token from <pCmd> line, interprets it as a hex * value, and stores the result in <pToken>.  If there are no remaining * tokens, stores <defVal> in <pToken> instead.** RETURNS: Pointer into <pStr> following end of copied <pToken>*/char *GetHexToken    (    char *pStr, 	/* input string */    long *pToken,	/* buffer to receive token value */    long defVal 	/* default value */    )    {    char temp [9];	/* Temp storage for token */    /* Retrieve next token */    pStr = GetNextToken (pStr, temp, sizeof (temp));    /* Evaluate Token value */    if (strlen (temp) == 0 || sscanf (temp, "%lx", pToken) == 0)	*pToken = defVal;    return pStr;    }/*************************************************************************** CmdParserHelpFunc - Displays list of supported commands** Displays the list of commands in the parser command table to <fout>.	* When the parser recognizes that this function is about to be executed, * it substitutes a pointer to the current CMD_DESCR table in <param>. * If this function is called directly, <param> should point to a table* of CMD_DESCR structures.** RETURNS: RET_CONTINUE*/UINT16 CmdParserHelpFunc    (    pVOID param,	    /* Generic parameter passed down */    char **ppCmd,	    /* Ptr to remainder of cmd line */    FILE *fin,		    /* stream for input (if any) */    FILE *fout		    /* stream for output (if any) */    )    {    CMD_DESCR *pCmdTable = (CMD_DESCR *) param;    char keyword [MAX_KEYWORD_LEN];    int lines = 0;    *ppCmd = GetNextToken (*ppCmd, keyword, sizeof (keyword));    if (strlen (keyword) == 0)	fprintf (fout, "\n");    for (; pCmdTable != NULL && pCmdTable->keyword != NULL; pCmdTable++) 	{	if (pCmdTable->help != NULL) 	    {	    /* If a parameter has been entered, display help only for 	     * matching cmds */	    if (strlen (keyword) > 0)		if (KeywordMatch (pCmdTable->keyword, 				  keyword, 				  max (strlen (keyword), 				       (unsigned)pCmdTable->minMatch)) 				 != 0)		    continue;	    /* Pause the display every PAUSE_DISPLAY lines */	    if (lines == PAUSE_DISPLAY) 		{		fprintf (fout,	 "[Press a key to continue]");		fgetc (fin);		fprintf (fout, "\r		\r");		lines = 0;		}	    fprintf (fout, "%*s  %s\n", 		     (strlen (keyword) == 0) ? 22 : 0,		     (pCmdTable->usage == NULL) ? 				pCmdTable->keyword : pCmdTable->usage, 		     pCmdTable->help);	    ++lines;	    }	}    if (strlen (keyword) == 0)	fprintf (fout, "\n\n");    return RET_CONTINUE;    }/*************************************************************************** CmdParserExitFunc - Terminates parser execution** Returns RET_OK, causing the parser to return RET_OK to the caller* signally normal termination of the parser.** RETURNS: RET_OK*/UINT16 CmdParserExitFunc    (    pVOID param,	    /* Generic parameter passed down */    char **ppCmd,	    /* Ptr to remainder of cmd line */    FILE *fin,		    /* stream for input (if any) */    FILE *fout		    /* stream for output (if any) */    )    {    return RET_OK;    }/* End of file. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色图免费看| 亚洲国产精品成人久久综合一区| 日韩限制级电影在线观看| 久久综合九色综合久久久精品综合| 亚洲美女在线国产| 国产伦精品一区二区三区视频青涩 | 亚洲主播在线播放| 高清在线观看日韩| 日韩欧美成人一区| 亚洲成人资源网| 日本高清视频一区二区| 国产日韩欧美激情| 韩国三级中文字幕hd久久精品| 欧美性生活大片视频| 国产精品网站在线观看| 韩国v欧美v日本v亚洲v| 欧美一区二区三区日韩视频| 一区二区三区中文字幕精品精品 | 国产精品18久久久| 亚洲精品一区二区三区香蕉| 天堂精品中文字幕在线| 欧美日韩精品高清| 亚洲国产视频网站| 色菇凉天天综合网| 亚洲精品老司机| 色综合久久天天| 日韩久久一区二区| 91猫先生在线| 一区二区三区蜜桃网| 色婷婷av一区二区三区之一色屋| 1区2区3区欧美| 99在线热播精品免费| 国产视频911| 成人的网站免费观看| 国产精品色婷婷久久58| 成人av免费在线观看| 国产精品电影院| 色哦色哦哦色天天综合| 亚洲国产色一区| 欧美日本免费一区二区三区| 视频一区国产视频| 精品国产一区二区亚洲人成毛片| 狠狠色丁香婷综合久久| 国产亚洲精品福利| av中文字幕不卡| 亚洲一区二区三区在线看| 在线观看一区二区精品视频| 午夜精品久久久久久久| 精品国精品国产| 成人国产免费视频| 亚洲午夜国产一区99re久久| 91精品久久久久久久久99蜜臂| 免费国产亚洲视频| 国产欧美精品区一区二区三区| 播五月开心婷婷综合| 亚洲一区二区中文在线| 日韩欧美中文字幕精品| 成人中文字幕合集| 亚洲一区视频在线| 久久久午夜电影| 91视频国产观看| 日本少妇一区二区| 成人欧美一区二区三区在线播放| 欧美日韩视频第一区| 国产在线精品一区在线观看麻豆| 国产亚洲综合色| 欧美在线一二三四区| 国产自产视频一区二区三区 | 久久美女高清视频| 色偷偷成人一区二区三区91| 美女久久久精品| 中文字幕一区在线观看| 欧美精品黑人性xxxx| 大桥未久av一区二区三区中文| 亚洲成人一区在线| 国产精品国产馆在线真实露脸| 在线播放91灌醉迷j高跟美女| 成人av电影在线| 久色婷婷小香蕉久久| 亚洲欧洲精品一区二区三区不卡| 欧美一区三区四区| 91麻豆国产香蕉久久精品| 久草热8精品视频在线观看| 亚洲人成影院在线观看| 久久综合五月天婷婷伊人| 欧美视频一区在线| 波多野结衣91| 国产一区在线视频| 蜜桃视频在线一区| 三级在线观看一区二区| 亚洲另类在线一区| 国产精品国产三级国产a| 久久五月婷婷丁香社区| 欧美精品v国产精品v日韩精品 | 中文字幕色av一区二区三区| 日韩欧美成人一区| 91精品国产入口| 91国偷自产一区二区三区成为亚洲经典 | 国产午夜久久久久| 欧美一级生活片| 欧美日韩国产系列| 欧美在线你懂得| 91丨porny丨在线| 不卡视频在线观看| 波波电影院一区二区三区| 国产高清不卡二三区| 国产福利91精品一区| 国产一区二区三区免费在线观看| 麻豆高清免费国产一区| 秋霞影院一区二区| 蜜臀av一区二区在线免费观看| 全部av―极品视觉盛宴亚洲| 日本不卡视频在线| 美女视频网站黄色亚洲| 韩国欧美一区二区| 国产精品资源在线看| 国产成人av一区二区| 国产成人免费视| 韩国毛片一区二区三区| 亚洲成人激情综合网| 亚洲精品成人少妇| 亚洲自拍偷拍麻豆| 亚洲一区二区欧美| 天堂一区二区在线| 久久成人久久爱| 狠狠色综合播放一区二区| 国产69精品久久777的优势| 成人激情图片网| 日本高清成人免费播放| 欧美日韩成人一区| 日韩精品在线一区二区| 久久精品亚洲乱码伦伦中文 | 91免费观看在线| 欧美视频一区在线| 日韩精品一区二区三区蜜臀| 久久久久久一级片| 亚洲欧美日韩中文播放| 午夜一区二区三区视频| 男男gaygay亚洲| 岛国一区二区三区| 欧美日韩中文一区| 亚洲精品一区二区三区香蕉| 国产精品精品国产色婷婷| 亚洲成人福利片| 黑人精品欧美一区二区蜜桃| 99国产欧美久久久精品| 在线播放中文字幕一区| 精品免费日韩av| 亚洲少妇中出一区| 麻豆精品在线视频| 99免费精品视频| 日韩一级黄色片| 最新日韩av在线| 精品一区二区在线免费观看| 99r精品视频| 日韩美女在线视频| 亚洲精品一二三区| 国内成人免费视频| 精品婷婷伊人一区三区三| 久久精品一区二区三区不卡牛牛| 一区二区三区毛片| 国产精品一级二级三级| 欧美视频你懂的| 国产精品免费看片| 日日噜噜夜夜狠狠视频欧美人 | 精品一区二区免费| 色噜噜夜夜夜综合网| 欧美精品一区二区高清在线观看| 一区二区三区精品视频| 国产成人亚洲综合a∨婷婷| 欧美日本国产视频| 亚洲欧美综合网| 国产高清亚洲一区| 日韩精品一区二区三区在线播放| 一区二区三区日本| 99热在这里有精品免费| 久久婷婷国产综合精品青草| 日韩精品久久理论片| 色婷婷综合中文久久一本| 中文乱码免费一区二区 | 视频一区二区三区在线| 91豆麻精品91久久久久久| 亚洲国产成人自拍| 国产一区二区在线观看视频| 69久久99精品久久久久婷婷| 一区二区三区毛片| 91女人视频在线观看| 国产精品久久久久久亚洲毛片| 久久不见久久见中文字幕免费| 欧美老女人在线| 亚洲午夜激情av| 欧美吻胸吃奶大尺度电影 | 欧美日韩精品一区二区三区| 亚洲情趣在线观看| 一本久久精品一区二区| 一区二区三区蜜桃| 欧美曰成人黄网| 一区二区三区四区高清精品免费观看 | 亚洲国产另类av| 欧美久久一区二区|