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

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

?? cmdparser.c

?? Vxworks5.5的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一区二区三区免费野_久草精品视频
亚洲午夜日本在线观看| 国产精品视频一二三| 精品国产精品一区二区夜夜嗨| 精品美女在线播放| 日韩伦理av电影| 久久99精品视频| 91网站最新网址| 欧美一区二区三区小说| 亚洲欧洲日产国码二区| 国产精品一区二区久激情瑜伽| 91官网在线观看| 国产日韩欧美高清| 免费成人在线视频观看| 一本久久精品一区二区| 久久综合av免费| 亚洲不卡一区二区三区| 欧美中文字幕亚洲一区二区va在线 | 日韩精品福利网| www.成人网.com| 精品久久久久久久久久久久包黑料 | 亚洲大尺度视频在线观看| 国产一区视频在线看| 日韩亚洲欧美在线观看| 亚洲黄一区二区三区| 国产高清一区日本| 日韩欧美一级精品久久| 日韩成人一级片| 在线一区二区三区| 日本一区二区视频在线| 国产一区91精品张津瑜| 日韩欧美国产三级| 蜜桃视频一区二区| 日韩一区和二区| 亚洲自拍偷拍综合| 精品视频一区三区九区| 亚洲欧美另类在线| 不卡一区在线观看| 久久精品一区二区三区四区| 国产最新精品精品你懂的| 欧美一区二区三区小说| 日本中文字幕不卡| 久久久精品免费免费| 激情丁香综合五月| 2023国产精品| aa级大片欧美| 亚洲视频资源在线| 日本韩国一区二区三区| 亚洲亚洲人成综合网络| 欧美精品日韩一区| 毛片av一区二区三区| 精品福利一区二区三区免费视频| 日本不卡视频一二三区| 日韩美女一区二区三区| 国产一区二区在线观看免费| 国产日韩欧美综合一区| jlzzjlzz欧美大全| 亚洲一区中文在线| 欧美日韩电影在线播放| 国产精品 日产精品 欧美精品| 久久先锋影音av| 床上的激情91.| 国产精品久久久久影院| 欧美曰成人黄网| 日本成人在线不卡视频| 精品日韩成人av| www.日韩精品| 午夜久久久久久| 精品久久人人做人人爽| 不卡影院免费观看| 另类人妖一区二区av| 中国av一区二区三区| 欧美在线一二三| 成人免费黄色大片| 一区二区三区四区中文字幕| 欧美日韩国产精品成人| 美女一区二区在线观看| 亚洲三级电影网站| 欧美二区在线观看| 国产成人av电影在线| 一区二区三区久久久| 精品国产一区二区三区不卡 | 男男视频亚洲欧美| 国产欧美日韩卡一| 欧美午夜影院一区| 成人免费观看av| 热久久一区二区| 国产精品久久久久精k8| 欧美精品久久久久久久久老牛影院| 国产精品一区二区视频| 亚洲国产aⅴ成人精品无吗| 久久一区二区三区国产精品| 91一区二区三区在线观看| 九九久久精品视频| 亚洲第一会所有码转帖| 国产精品视频九色porn| 国产一区视频导航| 一区二区不卡在线播放| 久久久久久毛片| 欧美日韩日日摸| 不卡欧美aaaaa| 极品少妇一区二区三区精品视频 | 麻豆91在线看| 亚洲在线观看免费视频| 国产午夜精品美女毛片视频| 欧美美女喷水视频| 欧美日本高清视频在线观看| av成人老司机| 国产69精品久久久久777| 一区二区三区四区在线播放| 亚洲人成网站影音先锋播放| 久久久99久久| 日韩午夜中文字幕| 日韩欧美国产一区在线观看| 欧美性色aⅴ视频一区日韩精品| 成人av网站免费| 国产不卡视频在线观看| 成人免费毛片嘿嘿连载视频| 国产精品自产自拍| 久久99久久99| 美国三级日本三级久久99| 久久99热国产| 国产成人精品免费看| 风间由美一区二区三区在线观看 | 在线电影院国产精品| 亚洲人成亚洲人成在线观看图片| 久久成人久久爱| 在线影院国内精品| 中文字幕在线观看不卡视频| 日韩美女视频一区| 91在线免费播放| 久久久综合九色合综国产精品| www激情久久| 国产91综合一区在线观看| 亚洲国产精品黑人久久久| 亚洲男人的天堂在线观看| av成人老司机| 一区二区三区av电影| 美腿丝袜亚洲一区| 精品久久久久久亚洲综合网| 麻豆精品久久精品色综合| 欧美精品一区二区三区四区| 色综合色综合色综合| 国产高清不卡一区| 91猫先生在线| 亚洲欧美区自拍先锋| 久热成人在线视频| 亚洲18女电影在线观看| 欧美国产综合色视频| 在线成人免费视频| 成人午夜免费视频| 亚洲精品成人精品456| 欧美久久久久久蜜桃| 色综合久久久久网| 国产成人在线观看免费网站| 欧美日本韩国一区二区三区视频| 粉嫩高潮美女一区二区三区| 亚洲欧美aⅴ...| 国产成人精品www牛牛影视| 精品一区二区三区欧美| 欧美色区777第一页| 中文乱码免费一区二区| 欧美一区二区三区免费观看视频| 国产成人亚洲综合色影视| 欧美日韩一区小说| 亚洲日本一区二区| 国产情人综合久久777777| 青青草原综合久久大伊人精品| 国产成人aaaa| 久久新电视剧免费观看| 久久99在线观看| 蜜桃一区二区三区在线观看| 欧美伊人久久大香线蕉综合69 | 欧美日韩一区 二区 三区 久久精品| 久久久高清一区二区三区| 免费成人小视频| 欧美二区乱c少妇| 欧美系列一区二区| 国产自产v一区二区三区c| 日韩一级二级三级| 69久久夜色精品国产69蝌蚪网| 99精品视频在线观看免费| 国产一区免费电影| 麻豆成人久久精品二区三区红 | 色噜噜狠狠一区二区三区果冻| 精品一区二区在线看| 欧美性做爰猛烈叫床潮| 中文字幕在线不卡一区二区三区| 日韩天堂在线观看| 秋霞电影网一区二区| jlzzjlzz亚洲日本少妇| 久久综合色天天久久综合图片| 国产v综合v亚洲欧| 久久久久久97三级| 国产精品91一区二区| 欧美精品一区二区三区四区 | 欧美三级日韩三级| 一区二区三区**美女毛片| 日本韩国欧美在线| 亚洲人妖av一区二区| 色偷偷一区二区三区|