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

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

?? cmdparser.c

?? vxworks嵌入式實時系統的 usb底層驅動代碼
?? 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一区二区三区免费野_久草精品视频
2020日本不卡一区二区视频| 日本精品视频一区二区三区| 午夜欧美电影在线观看| 亚洲精品亚洲人成人网在线播放| 国产精品毛片高清在线完整版| 国产日韩精品一区二区三区| 国产欧美在线观看一区| 中文字幕一区在线观看| 1024亚洲合集| 一区二区成人在线观看| 国内外精品视频| 国产综合成人久久大片91| 韩国精品久久久| www.欧美日韩| 欧美揉bbbbb揉bbbbb| 欧美一区二区三区四区视频| 日韩一区二区免费电影| 国产亚洲成年网址在线观看| 国产精品欧美久久久久无广告 | www.久久精品| 欧美在线观看你懂的| 7777精品伊人久久久大香线蕉完整版| 日韩视频一区在线观看| 久久久久久久久久美女| 亚洲女同一区二区| 老色鬼精品视频在线观看播放| 国产成人在线视频网站| 99精品国产视频| 91精品国产乱| 国产精品伦理在线| 青青草91视频| 粉嫩aⅴ一区二区三区四区五区 | 国产真实精品久久二三区| 成人av电影观看| 日韩丝袜美女视频| 国产精品国产三级国产普通话99| 亚洲国产成人av好男人在线观看| 精品一区二区免费在线观看| 日本高清成人免费播放| 久久亚洲一级片| 首页综合国产亚洲丝袜| 国产iv一区二区三区| 欧美视频在线播放| 亚洲一二三区不卡| proumb性欧美在线观看| 精品久久久三级丝袜| 亚洲亚洲精品在线观看| 国产不卡视频在线播放| 56国语精品自产拍在线观看| 国产精品伦一区二区三级视频| 看电影不卡的网站| 欧美日韩一二三区| 亚洲欧美电影一区二区| 国产成人在线看| 欧美大片日本大片免费观看| 亚洲一区二区成人在线观看| av在线播放成人| 国产欧美日韩精品一区| 国产传媒一区在线| 精品国产亚洲一区二区三区在线观看| 樱花草国产18久久久久| 99热这里都是精品| 中文字幕成人在线观看| 国产成人免费在线视频| 精品国产乱码久久久久久夜甘婷婷| 一区二区三区不卡视频| 91免费看`日韩一区二区| 中文字幕av一区二区三区免费看 | 亚洲不卡在线观看| 色拍拍在线精品视频8848| 国产精品成人午夜| 99久久精品国产一区二区三区| 国产欧美精品在线观看| 国产成人午夜高潮毛片| 久久精品视频在线看| 国产精品白丝av| 国产精品美女久久久久久久久久久| 国产剧情一区在线| 中文字幕成人av| 91亚洲精品一区二区乱码| 亚洲精品国产a| 欧美精品亚洲二区| 秋霞影院一区二区| 欧美一区二区免费视频| 韩国一区二区视频| 久久久国产午夜精品| 成人免费va视频| 亚洲一区二区三区国产| 欧美精品aⅴ在线视频| 美女诱惑一区二区| 久久精品一区二区三区不卡| 从欧美一区二区三区| 国产精品人人做人人爽人人添 | 天天色 色综合| 欧美大片国产精品| 不卡免费追剧大全电视剧网站| 亚洲欧洲精品一区二区精品久久久| 91福利视频网站| 精一区二区三区| 亚洲日本在线观看| 在线成人高清不卡| 成人污视频在线观看| 樱桃视频在线观看一区| 日韩欧美国产精品| 99精品视频在线免费观看| 亚洲va国产天堂va久久en| 精品国产乱码久久久久久久| 99精品欧美一区二区三区综合在线| 日韩高清不卡一区二区三区| 亚洲亚洲精品在线观看| 精品成人一区二区| 色噜噜久久综合| 国产在线精品不卡| 亚洲一卡二卡三卡四卡| 久久免费偷拍视频| 欧美人与性动xxxx| 成人av在线一区二区| 久久国产精品一区二区| 亚洲一区二区三区在线播放| 久久久99免费| 欧美一区二区三区四区视频| 99久久精品国产精品久久| 另类中文字幕网| 午夜视频在线观看一区二区 | 亚洲素人一区二区| 日韩写真欧美这视频| 欧美亚洲国产bt| 不卡的av在线| 国产一区二区三区四| 日韩精品成人一区二区三区 | 欧美另类变人与禽xxxxx| 国产精品一品视频| 免费欧美在线视频| 亚洲第一狼人社区| 一区二区在线看| 亚洲欧洲精品天堂一级 | 欧美成人伊人久久综合网| 91国产成人在线| 91麻豆精品在线观看| 懂色av一区二区在线播放| 国产一区二区日韩精品| 蜜臀91精品一区二区三区| 奇米影视一区二区三区| 亚洲一区二区精品3399| 一区二区三区鲁丝不卡| 亚洲免费观看高清完整版在线观看熊 | 久久久影视传媒| 精品欧美久久久| 2014亚洲片线观看视频免费| 精品久久久久久久久久久久久久久久久 | 欧美日韩五月天| 欧美精品vⅰdeose4hd| 欧美日韩国产成人在线91| 欧美性videosxxxxx| 91久久精品一区二区| 欧美日韩mp4| 欧美一区二区三区免费在线看| 欧美高清hd18日本| 在线播放视频一区| 欧美不卡视频一区| 久久久久青草大香线综合精品| 久久亚洲综合色一区二区三区| 久久婷婷色综合| 国产精品私人影院| 亚洲日本va午夜在线影院| 亚洲国产精品久久久久婷婷884| 亚洲成人1区2区| 免费黄网站欧美| 丁香桃色午夜亚洲一区二区三区| 波多野结衣中文一区| 在线看不卡av| 精品盗摄一区二区三区| 亚洲欧洲三级电影| 婷婷丁香久久五月婷婷| 久久99日本精品| 91麻豆福利精品推荐| 国产三级欧美三级日产三级99| 久久久久国产免费免费| 日韩理论片在线| 麻豆成人久久精品二区三区小说| 国产精品456| 欧美私模裸体表演在线观看| 欧美α欧美αv大片| 国产精品不卡一区二区三区| 日日骚欧美日韩| 成人国产精品免费观看视频| 欧美日韩在线播放| 国产欧美日产一区| 天天综合天天做天天综合| 国产jizzjizz一区二区| 7777精品伊人久久久大香线蕉完整版| 欧美国产一区二区在线观看| 亚洲永久精品大片| 丰满白嫩尤物一区二区| 6080午夜不卡| 亚洲一区电影777| www.av亚洲| 久久久精品人体av艺术| 五月天中文字幕一区二区| 99麻豆久久久国产精品免费优播|