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

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

?? getarg.c

?? 一款最完整的工業組態軟源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************
*  Routines to grab the	parameters from	the command line :		   *
* All the routines except the main one,	starts with GA (Get Arguments) to  *
* prevent from names conflicts.						   *
* It is	assumed	in these routine that any pointer, for any type	has the	   *
* same length (i.e. length of int pointer is equal to char pointer etc.)   *
*									   *
*  The following routines are available	in this	module:			   *
* 1. int GAGetArgs(argc, argv, CtrlStr, Variables...)			   *
*    where argc, argv as received on entry.				   *
*	   CtrlStr is the contrl string	(see below)			   *
*	   Variables are all the variables to be set according to CtrlStr. *
*	   Note	that all the variables MUST be transfered by address.	   *
*    return 0 on correct parsing, otherwise error number (see GetArg.h).   *
* 2. GAPrintHowTo(CtrlStr)						   *
*    Print the control string to stderr, in the	correct	format needed.	   *
*    This feature is very useful in case of error during GetArgs parsing.  *
*    Chars equal to SPACE_CHAR are not printed (regular spaces are NOT     *
*    allowed, and so using SPACE_CHAR you can create space in PrintHowTo). *
* 3. GAPrintErrMsg(Error)						   *
*    Print the error to	stderr,	according to Error (usually returned by	   *
*    GAGetArgs).							   *
*									   *
*     CtrlStr format:							   *
*   The	control	string passed to GetArgs controls the way argv (argc) are  *
* parsed. Each entry in	this string must not have any spaces in	it. The	   *
* First	Entry is the name of the program which is usually ignored except   *
* when GAPrintHowTo is called. All the other entries (except the last one  *
* which	we will	come back to it	later) must have the following format:	   *
* 1. One letter	which sets the option letter.				   *
* 2. '!' or '%'	to determines if this option is	really optional	('%') or   *
*    it	must exists ('!')...						   *
* 3. '-' allways.							   *
* 4. Alpha numeric string, usually ignored, but	used by	GAPrintHowTo to	   *
*    print the meaning of this input.					   *
* 5. Sequences starts with '!' or '%'. Again if	'!' then this sequence	   *
*    must exists (only if its option flag is given of course), and if '%'  *
*    it	is optional. Each sequence will	continue with one or two	   *
*    characters	which defines the kind of the input:			   *
*    a.	d, x, o, u - integer is expected (decimal, hex, octal base or	   *
*		  unsigned).						   *
*    b.	D, X, O, U - long integer is expected (same as above).		   *
*    c.	f	- float	number is expected.				   *
*    d.	F	- double number	is expected.				   *
*    e.	s	- string is expected.					   *
*    f.	*?	- any number of	'?' kind (d, x, o, u, D, X, O, U, f, F, s) *
*		  will match this one. If '?' is numeric, it scans until   *
*		  none numeric input is given. If '?' is 's' then it scans *
*		  up to the next option or end of argv.			   *
*									   *
*   If the last	parameter given	in the CtrlStr,	is not an option (i.e. the *
* second char is not in	['!', '%'] and the third one is not '-'), all what *
* remained from	argv is	linked to it.					   *
*									   *
*   The	variables passed to GAGetArgs (starting	from 4th parameter) MUST   *
* match	the order of the CtrlStr:					   *
*   For	each option, one integer address must be passed. This integer must *
* initialized by 0. If that option is given in the command line, it will   *
* be set to one.							   *
*   In addition, the sequences that might follow an option require the	   *
* following parameters to pass:						   *
* 1. d, x, o, u - pointer to integer (int *).				   *
* 2. D, X, O, U - pointer to long (long *).				   *
* 3. f	     - pointer to float	  (float *).				   *
* 4. F	     - pointer to double  (double *).				   *
* 5. s	     - pointer to char	  (char	*). NO allocation is needed!	   *
* 6. *?	     - TWO variables are passed	for each wild request. the first   *
*	       one is (address of) integer, and	it will	return number of   *
*	       parameters actually matched this	sequence, and the second   *
*	       one is a	pointer	to pointer to ?	(? **),	and will return	an *
*	       address to a block of pointers to ? kind, terminated with   *
*	       NULL pointer. NO	pre-allocation is needed.		   *
*	       note that these two variables are pretty	like the argv/argc *
*	       pair...							   *
*									   *
*   Examples:								   *
*									   *
*    "Example1  i%-OneInteger!d  s%-Strings!*s  j%-  k!-Float!f  Files"	   *
* Will match: Example1 -i 77 -s	String1	String2	String3	-k 88.2	File1 File2*
*   or match: Example1 -s String1 -k 88.3 -i 999 -j			   *
*    but not: Example1 -i 77 78	(option	i expects one integer, k must be). *
* Note the option k must exists, and that the order of the options is not  *
* not important. In the	first examples File1 & File2 will match	the Files  *
* in the command line.							   *
* A call to GAPrintHowTo with this CtrlStr will	print to stderr:	   *
* Example1 [-i OneIngeter] [-s Strings...] [-j]	-k Float Files...	   *
*									   *
*   Notes:								   *
*									   *
* 1. This module assumes that all the pointers to all kind of data types   *
*    have the same length and format, i.e. sizeof(int *) == sizeof(char	*).*
*									   *
*				      Gershon Elber    Ver 0.2	 Mar 88	   *
****************************************************************************
* History:								   *
* 11 Mar 88 - Version 1.0 by Gershon Elber.				   *
***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef __MSDOS__
#include <stdlib.h>
#include <alloc.h>
#endif /* __MSDOS__ */

#ifdef HAVE_VARARGS_H
    #include <varargs.h>
#elif defined(STDC_HEADERS)
    #include <stdarg.h>
#endif

#ifndef __MSDOS__
#include <stdlib.h>
#endif
#include <stdio.h>
#include <string.h>
#include "getarg.h"

#ifndef MYMALLOC
#define	MYMALLOC	   /* If no "MyMalloc" routine elsewhere define this. */
#endif

#define	MAX_PARAM	100	    /* maximum number of parameters allowed. */
#define	CTRL_STR_MAX_LEN	1024

#define SPACE_CHAR	'|'	  /* The character not to print using HowTo. */

#ifndef	TRUE
#define	TRUE -1
#define	FALSE 0
#endif /* TRUE */

#define	ARG_OK    0

#define	ISSPACE(x) ((x)	<= ' ')	       /* Not conventional - but works fine! */
/* The two characters '%' and '!' are used in the control string: */
#define	ISCTRLCHAR(x) (((x) == '%') || ((x) == '!'))

static char *GAErrorToken;/* On error code, ErrorToken is set to point on it.*/

static int GATestAllSatis(char *CtrlStrCopy, char *CtrlStr, int *argc,
	char ***argv, int *Parameters[MAX_PARAM], int *ParamCount);
static int GAUpdateParameters(int *Parameters[], int *ParamCount,
	char *Option, char *CtrlStrCopy, char *CtrlStr, int *argc,
	char ***argv);
static int GAGetParmeters(int *Parameters[], int *ParamCount,
	char *CtrlStrCopy , char *Option, int *argc, char ***argv);
static int GAGetMultiParmeters(int *Parameters[], int *ParamCount,
	char *CtrlStrCopy, int *argc, char ***argv);
static void GASetParamCount(char *CtrlStr, int Max, int *ParamCount);
static void GAByteCopy(char *Dst, char *Src, unsigned n);
static int GAOptionExists(int argc, char **argv);
#ifdef	MYMALLOC
static char *MyMalloc(unsigned size);
#endif	/* MYMALLOC */

/***************************************************************************
* Routine to access the	command	line argument and interpret them:	   *
* Return ARG_OK (0) is case of succesfull parsing, error code else...	   *
***************************************************************************/
#ifdef HAVE_VARARGS_H
int GAGetArgs(int va_alist, ...)
{
    va_list ap;
    int argc, i, Error = FALSE, ParamCount = 0,
	*Parameters[MAX_PARAM];		   /* Save here parameter addresses. */
    char **argv, *CtrlStr, *Option, CtrlStrCopy[CTRL_STR_MAX_LEN];

    va_start(ap);

    argc = va_arg(ap, int);
    argv = va_arg(ap, char **);
    CtrlStr = va_arg(ap, char *);

    va_end(ap);

    strcpy(CtrlStrCopy, CtrlStr);

    /* Using base address of parameters we access other parameters addr:  */
    /* Note that me (for sure!) samples data beyond the current function  */
    /* frame, but we accesson these set address only by demand.		  */
    for (i = 1; i <= MAX_PARAM; i++) Parameters[i-1] = va_arg(ap, int *);
#else /* HAVE_VARARGS_H */
int GAGetArgs(int argc, char **argv, char *CtrlStr, ...)
{
    int i, Error = FALSE, ParamCount = 0,
	*Parameters[MAX_PARAM];		   /* Save here parameter addresses. */
    char *Option, CtrlStrCopy[CTRL_STR_MAX_LEN];

    strcpy(CtrlStrCopy, CtrlStr);

	/** MRB - Where stdarg exists use it	**/
#ifdef STDC_HEADERS
   {va_list ap;
    va_start(ap, CtrlStr);
    for (i = 1; i <= MAX_PARAM; i++) Parameters[i-1] = va_arg(ap, int*);
    va_end(ap);
   }
#else
    /* Using base address of parameters we access other parameters addr:  */
    /* Note that me (for sure!) samples data beyond the current function  */
    /* frame, but we accesson these set address only by demand.		  */
    for (i = 1; i <= MAX_PARAM; i++) Parameters[i-1] = (int *) *(i + &CtrlStr);
#endif /* STDC_HEADERS */

#endif /* HAVE_VARARGS_H */

    --argc; argv++;	    /* Skip the program name (first in argv/c list). */
    while (argc >= 0) {
	if (!GAOptionExists(argc, argv)) break;			/* The loop. */
	argc--;
	Option	= *argv++;
	if ((Error = GAUpdateParameters(Parameters, &ParamCount, Option,
	     CtrlStrCopy, CtrlStr, &argc, &argv)) != FALSE) return Error;
    }
    /*	Check for results and update trail of command line: */
    return GATestAllSatis(CtrlStrCopy, CtrlStr, &argc, &argv, Parameters,
								 &ParamCount);
}

/***************************************************************************
* Routine to search for	unsatisfied flags - simply scan	the list for !-	   *
* sequence. Before this	scan, this routine updates the rest of the command *
* line into the	last two parameters if it is requested by the CtrlStr	   *
* (last	item in	CtrlStr	is NOT an option).				   *
* Return ARG_OK if all satisfied, CMD_ERR_AllSatis error else.		   *
***************************************************************************/
static int GATestAllSatis(char *CtrlStrCopy, char *CtrlStr, int *argc,
	char ***argv, int *Parameters[MAX_PARAM], int *ParamCount)
{
    int	i;
    static char	*LocalToken = NULL;

    /* If LocalToken is not initialized - do it now. Note that this string */
    /* should be writable as well so we can not assign it directly.        */
    if (LocalToken == NULL) {
        LocalToken = (char *) malloc(3);
	strcpy(LocalToken, "-?");
    }

    /* Check is	last item is an	option.	If not then copy rest of command */
    /* line into it as 1. NumOfprm, 2. pointer to block	of pointers.	 */
    for (i = strlen(CtrlStr) - 1; i > 0 && !ISSPACE(CtrlStr[i]); i--);
    if (!ISCTRLCHAR(CtrlStr[i + 2])) {
	GASetParamCount(CtrlStr, i, ParamCount);   /* Point in correct prm.. */
	*Parameters[(*ParamCount)++] = *argc;
	GAByteCopy((char *) Parameters[(*ParamCount)++], (char *) argv,
							sizeof(char *));
    }

    i =	0;
    while (++i < (int)strlen(CtrlStrCopy))
	if ((CtrlStrCopy[i] == '-') && (CtrlStrCopy[i-1] == '!')) {
	    GAErrorToken = LocalToken;
	    LocalToken[1] = CtrlStrCopy[i-2];	    /* Set the corrent flag. */
	    return CMD_ERR_AllSatis;
	}

    return ARG_OK;
}

/***************************************************************************
* Routine to update the	parameters according to	the given Option:	   *
***************************************************************************/
static int GAUpdateParameters(int *Parameters[], int *ParamCount,
       char *Option, char *CtrlStrCopy, char *CtrlStr, int *argc, char ***argv)
{
    int	i, BooleanTrue = Option[2] != '-';

    if (Option[0] != '-') {
	GAErrorToken = Option;
	return CMD_ERR_NotAnOpt;
    }
    i =	0;			    /* Scan the CtrlStrCopy for that option: */
    while (i + 2 < (int)strlen(CtrlStrCopy)) {
	if ((CtrlStrCopy[i] == Option[1]) && (ISCTRLCHAR(CtrlStrCopy[i + 1]))
	    && (CtrlStrCopy[i+2] == '-')) {
	    /* We found	that option! */
	    break;
	}
	i++;
    }
    if (i + 2 >= (int)strlen(CtrlStrCopy)) {
	GAErrorToken = Option;
	return CMD_ERR_NoSuchOpt;
    }

    /* If we are here, then we found that option in CtrlStr - Strip it off:  */
    CtrlStrCopy[i] = CtrlStrCopy[i + 1] = CtrlStrCopy[i + 2] = (char) ' ';
    GASetParamCount(CtrlStr, i, ParamCount);/*Set it to point in correct prm.*/
    i += 3;
    /* Set boolean flag for that option. */
    *Parameters[(*ParamCount)++] = BooleanTrue;
    if (ISSPACE(CtrlStrCopy[i]))
	return ARG_OK;			   /* Only a boolean flag is needed. */

    /* Skip the	text between the boolean option and data follows: */
    while (!ISCTRLCHAR(CtrlStrCopy[i]))	i++;
    /* Get the parameters and return the appropriete return code: */
    return GAGetParmeters(Parameters, ParamCount, &CtrlStrCopy[i],
							  Option, argc, argv);
}

/***************************************************************************
* Routine to get parameters according to the CtrlStr given from	argv/c :   *
***************************************************************************/
static int GAGetParmeters(int *Parameters[], int *ParamCount,
	char *CtrlStrCopy , char *Option, int *argc, char ***argv)
{
    int	i = 0, ScanRes;

    while (!(ISSPACE(CtrlStrCopy[i]))) {
	switch (CtrlStrCopy[i+1]) {
	    case 'd':				     /* Get signed integers. */
		ScanRes	= sscanf(*((*argv)++), "%d",
					 (int *) Parameters[(*ParamCount)++]);
		break;
	    case 'u':				   /* Get unsigned integers. */
		ScanRes	= sscanf(*((*argv)++), "%u",
				    (unsigned *) Parameters[(*ParamCount)++]);
		break;
	    case 'x':					/* Get hex integers. */
		ScanRes	= sscanf(*((*argv)++), "%x",
					 (int *) Parameters[(*ParamCount)++]);
		break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线视频日韩| 麻豆freexxxx性91精品| 亚洲国产精品久久人人爱蜜臀| 亚洲女人小视频在线观看| 一区二区免费看| 日本aⅴ精品一区二区三区| 国产精品自拍一区| 在线视频一区二区免费| 91精品国产一区二区| 国产清纯白嫩初高生在线观看91 | 国产网站一区二区| 成人欧美一区二区三区黑人麻豆 | 国产在线国偷精品产拍免费yy| thepron国产精品| 欧美日韩国产免费一区二区| 日韩精品一区二| 亚洲少妇30p| 久久99精品国产.久久久久久| 国产999精品久久| 欧美性感一类影片在线播放| 久久综合九色综合97婷婷| 亚洲欧美日韩一区二区 | 色综合久久88色综合天天免费| 欧美精品久久久久久久久老牛影院| 精品精品欲导航| 亚洲欧洲日韩一区二区三区| 日韩国产欧美三级| 99精品视频一区二区三区| 91麻豆精品国产自产在线观看一区 | 欧美国产丝袜视频| 天天色 色综合| 成人黄页在线观看| 制服视频三区第一页精品| 国产精品久久久久久亚洲毛片| 亚洲6080在线| 成人成人成人在线视频| 日韩久久免费av| 一区二区三区在线视频免费| 91官网在线免费观看| 欧美精品一区二区三区在线| 一区二区三区中文字幕在线观看| 韩国精品主播一区二区在线观看| 在线播放视频一区| 风间由美性色一区二区三区| 大尺度一区二区| 日韩欧美国产一区在线观看| 一区二区三区在线免费播放| 国产成a人亚洲精| 日韩亚洲欧美成人一区| 一区二区三区波多野结衣在线观看| 国产高清成人在线| 欧美一区二区三区四区在线观看| 亚洲精品视频在线观看免费| 国产成a人亚洲| 26uuu精品一区二区| 日本大胆欧美人术艺术动态| 色哦色哦哦色天天综合| 国产精品不卡在线观看| 国产一二精品视频| 26uuu亚洲综合色| 另类综合日韩欧美亚洲| 91精品国产综合久久香蕉的特点 | 久久99精品久久只有精品| 欧美精品一卡二卡| 亚洲国产中文字幕在线视频综合| 91碰在线视频| 国产精品国产三级国产普通话蜜臀| 国产一区二区按摩在线观看| 精品成a人在线观看| 久久成人免费日本黄色| 欧美成人精品二区三区99精品| 午夜精品久久久久久久蜜桃app | 亚洲1区2区3区4区| 欧美三级乱人伦电影| 亚洲尤物视频在线| 欧美色区777第一页| 亚洲午夜激情网页| 欧美乱妇15p| 亚洲成a人v欧美综合天堂下载 | 亚洲图片另类小说| 99久久免费精品高清特色大片| 1000精品久久久久久久久| 成人18精品视频| 中文字幕日韩欧美一区二区三区| 成人app下载| 亚洲少妇屁股交4| 欧美午夜在线一二页| 亚洲第一激情av| 91麻豆精品国产| 看片网站欧美日韩| 欧美激情在线一区二区| av激情综合网| 樱桃视频在线观看一区| 欧美三片在线视频观看 | 欧美一区二区视频在线观看2020 | 欧美一级夜夜爽| 久久精品国产亚洲a| 久久午夜国产精品| av一区二区三区四区| 亚洲精品视频在线观看网站| 欧美日韩国产综合视频在线观看| 日本强好片久久久久久aaa| 日韩欧美亚洲一区二区| 国产成人精品免费视频网站| 亚洲欧洲日本在线| 4438亚洲最大| 国产老女人精品毛片久久| ...xxx性欧美| 欧美日韩www| 国产精品一二三四区| 国产精品色眯眯| 欧美性色综合网| 久久精品二区亚洲w码| 日本一二三四高清不卡| 久久久久久久久伊人| 成人91在线观看| 午夜精品aaa| 久久久久久久久岛国免费| 91在线视频在线| 青青草国产精品亚洲专区无| 中文字幕不卡在线| 欧美日韩免费在线视频| 国产二区国产一区在线观看| 一区二区免费视频| 久久亚洲私人国产精品va媚药| 97精品久久久久中文字幕| 日本 国产 欧美色综合| 综合久久久久综合| 6080国产精品一区二区| 成人午夜免费av| 日日夜夜免费精品| 中文字幕中文字幕一区二区| 欧美人与禽zozo性伦| 国产麻豆成人精品| 亚洲1区2区3区4区| 亚洲欧美在线观看| 日韩精品中文字幕一区| 欧美午夜精品一区| 国产成人av资源| 爽爽淫人综合网网站| 欧美国产欧美亚州国产日韩mv天天看完整 | 在线观看www91| 国产精品一区不卡| 青青国产91久久久久久 | 欧洲人成人精品| 国产电影一区二区三区| 日本免费新一区视频| 亚洲免费观看高清在线观看| 久久综合九色综合97_久久久| 欧美日韩精品福利| 91丨九色丨尤物| 国产一区二区三区国产| 日韩激情一二三区| 亚洲自拍欧美精品| 亚洲视频在线一区二区| 久久久激情视频| 欧美刺激午夜性久久久久久久| 欧洲精品一区二区三区在线观看| 丁香五精品蜜臀久久久久99网站 | 欧美日高清视频| 91黄视频在线| caoporn国产精品| 国产乱一区二区| 久久se这里有精品| 免费成人深夜小野草| 日韩中文字幕一区二区三区| 亚洲精品菠萝久久久久久久| 国产精品剧情在线亚洲| 久久久久国产精品厨房| 欧美精品一区二区三区一线天视频| 欧美一区二区三区视频在线观看 | 一区二区不卡在线播放 | 色婷婷综合久久久久中文一区二区 | 在线观看三级视频欧美| 91小视频免费观看| www.亚洲在线| 成人sese在线| 波多野结衣在线aⅴ中文字幕不卡| 国产一区在线精品| 黑人精品欧美一区二区蜜桃 | 欧美日韩你懂得| 欧美日韩国产在线观看| 欧美亚洲高清一区二区三区不卡| 一本到不卡免费一区二区| 91蝌蚪porny九色| 在线欧美日韩精品| 91福利在线免费观看| 欧美午夜精品一区| 欧美日韩在线三级| 欧美猛男超大videosgay| 欧美高清激情brazzers| 538在线一区二区精品国产| 91精品国产黑色紧身裤美女| 69av一区二区三区| 精品欧美乱码久久久久久| 精品国产一区二区亚洲人成毛片| 2019国产精品| 欧美韩国日本综合| 国产精品护士白丝一区av| 中文字幕一区二区三|