[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpm-cvs
Subject:    [CVS] RPM: popt/ CHANGES libpopt.vers popt.3 popt.c popt.h popthelp.c ...
From:       "Jeff Johnson" <jbj () rpm5 ! org>
Date:       2009-07-25 18:52:37
Message-ID: 20090725185237.1BCBE249FE () rpm5 ! org
[Download RAW message or body]

  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: popt                             Date:   25-Jul-2009 20:52:37
  Branch: HEAD                             Handle: 2009072518523600

  Modified files:
    popt                    CHANGES libpopt.vers popt.3 popt.c popt.h
                            popthelp.c poptint.h test1.c testit.sh

  Log:
    - add POPT_ARG_SHORT handling.

  Summary:
    Revision    Changes     Path
    1.112       +1  -0      popt/CHANGES
    1.7         +1  -0      popt/libpopt.vers
    1.21        +4  -3      popt/popt.3
    1.132       +103 -75    popt/popt.c
    1.73        +18 -1      popt/popt.h
    1.93        +5  -0      popt/popthelp.c
    1.42        +1  -0      popt/poptint.h
    1.41        +15 -4      popt/test1.c
    1.29        +35 -30     popt/testit.sh
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: popt/CHANGES
  ============================================================================
  $ cvs diff -u -r1.111 -r1.112 CHANGES
  --- popt/CHANGES	25 Jul 2009 16:30:03 -0000	1.111
  +++ popt/CHANGES	25 Jul 2009 18:52:36 -0000	1.112
  @@ -1,4 +1,5 @@
   1.15 -> 1.16:
  +    - add POPT_ARG_SHORT handling.
       - handle all callback traversals within a C switch (for extendability ease).
       - add popt.pc.
   
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/libpopt.vers
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 libpopt.vers
  --- popt/libpopt.vers	25 Jan 2009 15:23:03 -0000	1.6
  +++ popt/libpopt.vers	25 Jul 2009 18:52:36 -0000	1.7
  @@ -35,6 +35,7 @@
       poptSaveInt;
       poptSaveLong;
       poptSaveLongLong;
  +    poptSaveShort;
       poptSaveString;
       poptSetExecPath;
       poptSetOtherOptionHelp;
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/popt.3
  ============================================================================
  $ cvs diff -u -r1.20 -r1.21 popt.3
  --- popt/popt.3	17 Jul 2008 12:54:02 -0000	1.20
  +++ popt/popt.3	25 Jul 2009 18:52:36 -0000	1.21
  @@ -126,6 +126,7 @@
   POPT_ARG_NONE	No argument expected	int
   POPT_ARG_STRING	No type checking to be performed	char *
   POPT_ARG_ARGV	No type checking to be performed	char **
  +POPT_ARG_SHORT	An short argument is expected	short
   POPT_ARG_INT	An integer argument is expected	int
   POPT_ARG_LONG	A long integer is expected	long
   POPT_ARG_LONGLONG	A long long integer is expected	long long
  @@ -164,7 +165,7 @@
   an argument, the variable that 
   .IR arg " points to is updated to reflect the value of the argument." 
   .RB "Any string is acceptable for " POPT_ARG_STRING " and " POPT_ARG_ARGV " \
                arguments, but "
  -.BR POPT_ARG_INT ", " POPT_ARG_LONG ", " POPT_ARG_LONGLONG ", " POPT_ARG_FLOAT ", \
and "  +.BR POPT_ARG_INT ", " POPT_ARG_SHORT ", " POPT_ARG_LONG ", " \
                POPT_ARG_LONGLONG ", " POPT_ARG_FLOAT ", and "
   .BR POPT_ARG_DOUBLE " are converted to the appropriate type, and an "
   error returned if the conversion fails.
   .sp
  @@ -474,7 +475,7 @@
   A conversion from a string to a number (int or long) failed due
   to the string containing nonnumeric characters. This occurs when
   .BR poptGetNextOpt() " is processing an argument of type " 
  -.BR POPT_ARG_INT ", " POPT_ARG_LONG ", " POPT_ARG_LONGLONG ", "
  +.BR POPT_ARG_INT ", " POPT_ARG_SHORT ", " POPT_ARG_LONG ", " POPT_ARG_LONGLONG ", \
                "
   .RB POPT_ARG_FLOAT ", or " POPT_ARG_DOUBLE "."  
   .sp
   .TP
  @@ -482,7 +483,7 @@
   A string-to-number conversion failed because the number was too
   .RB "large or too small. Like " POPT_ERROR_BADNUMBER ", this error 
   .RB "can occur only when " poptGetNextOpt() " is processing an "
  -.RB "argument of type " POPT_ARG_INT ", " POPT_ARG_LONG ", " POPT_ARG_LONGLONG ", \
"  +.RB "argument of type " POPT_ARG_INT ", " POPT_ARG_SHORT ", " POPT_ARG_LONG ", " \
                POPT_ARG_LONGLONG ", "
   .RB POPT_ARG_FLOAT ", or " POPT_ARG_DOUBLE "."  
   .sp
   .TP
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/popt.c
  ============================================================================
  $ cvs diff -u -r1.131 -r1.132 popt.c
  --- popt/popt.c	25 Jul 2009 16:30:03 -0000	1.131
  +++ popt/popt.c	25 Jul 2009 18:52:36 -0000	1.132
  @@ -462,13 +462,10 @@
       }
   
       /* If no executable was found in PATH, return NULL. */
  -    if (!(s && *s) && t != NULL) {
  -	free(t);
  -	t = NULL;
  -    }
  +    if (!(s && *s) && t != NULL)
  +	t = _free(t);
   /*@-modobserver -observertrans -usedef @*/
  -    if (path != NULL)
  -        free(path);
  +    path = _free(path);
   /*@=modobserver =observertrans =usedef @*/
   
       return t;
  @@ -575,7 +572,8 @@
       return ec;
   }
   
  -/*@observer@*/ /*@null@*/ static const struct poptOption *
  +/*@observer@*/ /*@null@*/
  +static const struct poptOption *
   findOption(const struct poptOption * opt,
   		/*@null@*/ const char * longName, size_t longNameLen,
   		char shortName,
  @@ -637,9 +635,9 @@
       if (callback)
   	*callback = (cb ? cbarg.cb : NULL);
       if (callbackData)
  -/*@-observertrans@*/	/* FIX: typedef double indirection. */
  +/*@-observertrans -dependenttrans @*/
   	*callbackData = (cb && !CBF_ISSET(cb, INC_DATA) ? cb->descrip : NULL);
  -/*@=observertrans@*/
  +/*@=observertrans =dependenttrans @*/
   /*@=modobserver =mods @*/
   
       return opt;
  @@ -757,8 +755,8 @@
   {
       int argc = 0;
   
  -    if (argvp == NULL)
  -	return -1;
  +    if (argvp == NULL || val == NULL)
  +	return POPT_ERROR_NULLARG;
   
       /* XXX likely needs an upper bound on argc. */
       if (*argvp != NULL)
  @@ -844,18 +842,10 @@
       if (LF_ISSET(NOT))
   	aLong = ~aLong;
       switch (LF_ISSET(LOGICALOPS)) {
  -    case 0:
  -	*arg = aLong;
  -	break;
  -    case POPT_ARGFLAG_OR:
  -	*(unsigned long *)arg |= (unsigned long)aLong;
  -	break;
  -    case POPT_ARGFLAG_AND:
  -	*(unsigned long *)arg &= (unsigned long)aLong;
  -	break;
  -    case POPT_ARGFLAG_XOR:
  -	*(unsigned long *)arg ^= (unsigned long)aLong;
  -	break;
  +    case 0:		   *arg = aLong; break;
  +    case POPT_ARGFLAG_OR:  *(unsigned long *)arg |= (unsigned long)aLong; break;
  +    case POPT_ARGFLAG_AND: *(unsigned long *)arg &= (unsigned long)aLong; break;
  +    case POPT_ARGFLAG_XOR: *(unsigned long *)arg ^= (unsigned long)aLong; break;
       default:
   	return POPT_ERROR_BADOPERATION;
   	/*@notreached@*/ break;
  @@ -885,20 +875,48 @@
       if (LF_ISSET(NOT))
   	aLong = ~aLong;
       switch (LF_ISSET(LOGICALOPS)) {
  -    case 0:
  -	*arg = (int) aLong;
  +    case 0:		   *arg = (int) aLong;				break;
  +    case POPT_ARGFLAG_OR:  *(unsigned int *)arg |= (unsigned int) aLong; break;
  +    case POPT_ARGFLAG_AND: *(unsigned int *)arg &= (unsigned int) aLong; break;
  +    case POPT_ARGFLAG_XOR: *(unsigned int *)arg ^= (unsigned int) aLong; break;
  +    default:
  +	return POPT_ERROR_BADOPERATION;
  +	/*@notreached@*/ break;
  +    }
  +    return 0;
  +}
  +
  +int poptSaveShort(/*@null@*/ short * arg, unsigned int argInfo, long aLong)
  +{
  +    /* XXX Check alignment, may fail on funky platforms. */
  +    if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
  +	return POPT_ERROR_NULLARG;
  +
  +    if (aLong != 0 && LF_ISSET(RANDOM)) {
  +#if defined(HAVE_SRANDOM)
  +	if (!seed) {
  +	    srandom((unsigned)getpid());
  +	    srandom((unsigned)random());
  +	}
  +	aLong = random() % (aLong > 0 ? aLong : -aLong);
  +	aLong++;
  +#else
  +	/* XXX avoid adding POPT_ERROR_UNIMPLEMENTED to minimize i18n churn. */
  +	return POPT_ERROR_BADOPERATION;
  +#endif
  +    }
  +    if (LF_ISSET(NOT))
  +	aLong = ~aLong;
  +    switch (LF_ISSET(LOGICALOPS)) {
  +    case 0:		   *arg = (short) aLong;
   	break;
  -    case POPT_ARGFLAG_OR:
  -	*(unsigned int *)arg |= (unsigned int) aLong;
  +    case POPT_ARGFLAG_OR:  *(unsigned short *)arg |= (unsigned short) aLong;
   	break;
  -    case POPT_ARGFLAG_AND:
  -	*(unsigned int *)arg &= (unsigned int) aLong;
  +    case POPT_ARGFLAG_AND: *(unsigned short *)arg &= (unsigned short) aLong;
   	break;
  -    case POPT_ARGFLAG_XOR:
  -	*(unsigned int *)arg ^= (unsigned int) aLong;
  +    case POPT_ARGFLAG_XOR: *(unsigned short *)arg ^= (unsigned short) aLong;
   	break;
  -    default:
  -	return POPT_ERROR_BADOPERATION;
  +    default: return POPT_ERROR_BADOPERATION;
   	/*@notreached@*/ break;
       }
       return 0;
  @@ -944,14 +962,12 @@
   	/*@modifies con, fileSystem, internalState @*/
   {
       poptArg arg = { .ptr = opt->arg };
  +    int rc = 0;		/* assume success */
   
       switch (poptArgType(opt)) {
       case POPT_ARG_ARGV:
   	/* XXX memory leak, application is responsible for free. */
  -	if (con->os->nextArg == NULL)
  -	    return POPT_ERROR_NULLARG;	/* XXX better return? */
  -	if (poptSaveString(arg.ptr, opt->argInfo, con->os->nextArg))
  -	    return POPT_ERROR_BADOPERATION;
  +	rc = poptSaveString(arg.ptr, opt->argInfo, con->os->nextArg);
   	/*@switchbreak@*/ break;
       case POPT_ARG_STRING:
   	/* XXX memory leak, application is responsible for free. */
  @@ -959,75 +975,87 @@
   	/*@switchbreak@*/ break;
   
       case POPT_ARG_INT:
  +    case POPT_ARG_SHORT:
       case POPT_ARG_LONG:
       case POPT_ARG_LONGLONG:
  -    {   long long aNUM = 0;
  +    {	unsigned int argInfo = poptArgInfo(con, opt);
   	char *end = NULL;
  -	unsigned int argInfo = poptArgInfo(con, opt);
  +	long long aNUM = 0;
   
   	if (con->os->nextArg) {
   	    aNUM = strtoll(con->os->nextArg, &end, 0);
  -	    if (!(end && *end == '\0'))
  -		return POPT_ERROR_BADNUMBER;
  +	    if (!(end && *end == '\0')) {
  +		rc = POPT_ERROR_BADNUMBER;
  +		break;
  +	    }
   	}
   
  +	switch (poptArgType(opt)) {
  +	case POPT_ARG_LONGLONG:
   /* XXX let's not demand C99 compiler flags for <limits.h> quite yet. */
   #if !defined(LLONG_MAX)
   #   define LLONG_MAX    9223372036854775807LL
   #   define LLONG_MIN    (-LLONG_MAX - 1LL)
   #endif
  -
  -	if (poptArgType(opt) == POPT_ARG_LONGLONG) {
  -	    if (aNUM == LLONG_MAX || aNUM == LLONG_MIN)
  -		return POPT_ERROR_OVERFLOW;
  -	    if (poptSaveLongLong(arg.longlongp, argInfo, aNUM))
  -		return POPT_ERROR_BADOPERATION;
  -	} else
  -	if (poptArgType(opt) == POPT_ARG_LONG) {
  -	    if (aNUM > (long long)LONG_MAX || aNUM < (long long)LONG_MIN)
  -		return POPT_ERROR_OVERFLOW;
  -	    if (poptSaveLong(arg.longp, argInfo, (long)aNUM))
  -		return POPT_ERROR_BADOPERATION;
  -	} else
  -	if (poptArgType(opt) == POPT_ARG_INT) {
  -	    if (aNUM > (long long)INT_MAX || aNUM < (long long)INT_MIN)
  -		return POPT_ERROR_OVERFLOW;
  -	    if (poptSaveInt(arg.intp, argInfo, (long)aNUM))
  -		return POPT_ERROR_BADOPERATION;
  -	} else
  -	    return POPT_ERROR_BADOPERATION;
  +	    rc = !(aNUM == LLONG_MIN || aNUM == LLONG_MAX)
  +		? poptSaveLongLong(arg.longlongp, argInfo, aNUM)
  +		: POPT_ERROR_OVERFLOW;
  +	    /*@innerbreak@*/ break;
  +	case POPT_ARG_LONG:
  +	    rc = !(aNUM < (long long)LONG_MIN || aNUM > (long long)LONG_MAX)
  +		? poptSaveLong(arg.longp, argInfo, (long)aNUM)
  +		: POPT_ERROR_OVERFLOW;
  +	    /*@innerbreak@*/ break;
  +	case POPT_ARG_INT:
  +	    rc = !(aNUM < (long long)INT_MIN || aNUM > (long long)INT_MAX)
  +		? poptSaveInt(arg.intp, argInfo, (long)aNUM)
  +		: POPT_ERROR_OVERFLOW;
  +	    /*@innerbreak@*/ break;
  +	case POPT_ARG_SHORT:
  +	    rc = !(aNUM < (long long)SHRT_MIN || aNUM > (long long)SHRT_MAX)
  +		? poptSaveShort(arg.shortp, argInfo, (long)aNUM)
  +		: POPT_ERROR_OVERFLOW;
  +	    /*@innerbreak@*/ break;
  +	}
       }   /*@switchbreak@*/ break;
   
       case POPT_ARG_FLOAT:
       case POPT_ARG_DOUBLE:
  -    {   double aDouble = 0.0;
  -	char *end;
  +    {	char *end = NULL;
  +	double aDouble = 0.0;
   
   	if (con->os->nextArg) {
   /*@-mods@*/
   	    int saveerrno = errno;
   	    errno = 0;
   	    aDouble = strtod(con->os->nextArg, &end);
  -	    if (errno == ERANGE)
  -		return POPT_ERROR_OVERFLOW;
  +	    if (errno == ERANGE) {
  +		rc = POPT_ERROR_OVERFLOW;
  +		break;
  +	    }
   	    errno = saveerrno;
   /*@=mods@*/
  -	    if (*end != '\0')
  -		return POPT_ERROR_BADNUMBER;
  +	    if (*end != '\0') {
  +		rc = POPT_ERROR_BADNUMBER;
  +		break;
  +	    }
   	}
   
  -	if (poptArgType(opt) == POPT_ARG_DOUBLE) {
  +	switch (poptArgType(opt)) {
  +	case POPT_ARG_DOUBLE:
   	    arg.doublep[0] = aDouble;
  -	} else {
  +	    /*@innerbreak@*/ break;
  +	case POPT_ARG_FLOAT:
   #if !defined(DBL_EPSILON) && !defined(__LCLINT__)
   #define DBL_EPSILON 2.2204460492503131e-16
   #endif
   #define POPT_ABS(a)	((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a))
  -	    if ((POPT_ABS(aDouble) - FLT_MAX) > DBL_EPSILON)
  -		return POPT_ERROR_OVERFLOW;
  -	    if ((FLT_MIN - POPT_ABS(aDouble)) > DBL_EPSILON)
  -		return POPT_ERROR_OVERFLOW;
  -	    arg.floatp[0] = (float) aDouble;
  +	    if ((FLT_MIN - POPT_ABS(aDouble)) > DBL_EPSILON
  +	     || (POPT_ABS(aDouble) - FLT_MAX) > DBL_EPSILON)
  +		rc = POPT_ERROR_OVERFLOW;
  +	    else
  +		arg.floatp[0] = (float) aDouble;
  +	    /*@innerbreak@*/ break;
   	}
       }   /*@switchbreak@*/ break;
       case POPT_ARG_MAINCALL:
  @@ -1041,7 +1069,7 @@
   	exit(EXIT_FAILURE);
   	/*@notreached@*/ /*@switchbreak@*/ break;
       }
  -    return 0;
  +    return rc;
   }
   
   /* returns 'val' element, -1 on last item, POPT_ERROR_* on error */
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/popt.h
  ============================================================================
  $ cvs diff -u -r1.72 -r1.73 popt.h
  --- popt/popt.h	25 Jan 2009 17:38:53 -0000	1.72
  +++ popt/popt.h	25 Jul 2009 18:52:36 -0000	1.73
  @@ -37,6 +37,7 @@
   
   #define POPT_ARG_MAINCALL	16U+11U	/*!< EXPERIMENTAL: return (*arg) (argc, argv) */
   #define	POPT_ARG_ARGV		12U	/*!< dupe'd arg appended to realloc'd argv array. */
  +#define	POPT_ARG_SHORT		13U	/*!< arg ==> short */
   
   #define POPT_ARG_MASK		0x000000FFU
   #define POPT_GROUP_MASK		0x0000FF00U
  @@ -605,7 +606,7 @@
    * @retval *argvp	argv array
    * @param argInfo	(unused)
    * @param val		string arg to add (using strdup)
  - * @return		0 always
  + * @return		0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
    */
   /*@unused@*/
   int poptSaveString(/*@null@*/ const char *** argvp, unsigned int argInfo,
  @@ -646,6 +647,22 @@
   /*@=incondefs@*/
   
   /**
  + * Save a short integer, performing logical operation with value.
  + * @warning Alignment check may be too strict on certain platorms.
  + * @param arg		short pointer, aligned on short boundary.
  + * @param argInfo	logical operation (see POPT_ARGFLAG_*)
  + * @param aLong		value to use
  + * @return		0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
  + */
  +/*@-incondefs@*/
  +/*@unused@*/
  +int poptSaveShort(/*@null@*/ short * arg, unsigned int argInfo, long aLong)
  +	/*@globals internalState @*/
  +	/*@modifies *arg, internalState @*/
  +	/*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/;
  +/*@=incondefs@*/
  +
  +/**
    * Save an integer, performing logical operation with value.
    * @warning Alignment check may be too strict on certain platorms.
    * @param arg		integer pointer, aligned on int boundary.
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/popthelp.c
  ============================================================================
  $ cvs diff -u -r1.92 -r1.93 popthelp.c
  --- popt/popthelp.c	21 Jan 2009 22:29:10 -0000	1.92
  +++ popt/popthelp.c	25 Jul 2009 18:52:36 -0000	1.93
  @@ -204,6 +204,7 @@
       case POPT_ARG_VAL:		return NULL;
   #endif
       case POPT_ARG_INT:		return POPT_("INT");
  +    case POPT_ARG_SHORT:	return POPT_("SHORT");
       case POPT_ARG_LONG:		return POPT_("LONG");
       case POPT_ARG_LONGLONG:	return POPT_("LONGLONG");
       case POPT_ARG_STRING:	return POPT_("STRING");
  @@ -247,6 +248,9 @@
       case POPT_ARG_INT:
   	le += sprintf(le, "%d", arg.intp[0]);
   	break;
  +    case POPT_ARG_SHORT:
  +	le += sprintf(le, "%hd", arg.shortp[0]);
  +	break;
       case POPT_ARG_LONG:
   	le += sprintf(le, "%ld", arg.longp[0]);
   	break;
  @@ -422,6 +426,7 @@
   #endif
   		break;
   	    case POPT_ARG_INT:
  +	    case POPT_ARG_SHORT:
   	    case POPT_ARG_LONG:
   	    case POPT_ARG_LONGLONG:
   	    case POPT_ARG_FLOAT:
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/poptint.h
  ============================================================================
  $ cvs diff -u -r1.41 -r1.42 poptint.h
  --- popt/poptint.h	12 Apr 2009 17:56:17 -0000	1.41
  +++ popt/poptint.h	25 Jul 2009 18:52:36 -0000	1.42
  @@ -58,6 +58,7 @@
   /*@shared@*/
       void * ptr;
       int * intp;
  +    short * shortp;
       long * longp;
       long long * longlongp;
       float * floatp;
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/test1.c
  ============================================================================
  $ cvs diff -u -r1.40 -r1.41 test1.c
  --- popt/test1.c	24 Jan 2009 18:12:38 -0000	1.40
  +++ popt/test1.c	25 Jul 2009 18:52:36 -0000	1.41
  @@ -38,6 +38,10 @@
   static unsigned int bFlag = 0x8aceU;
   
   /*@unchecked@*/
  +static short aShort = 4523;
  +/*@unchecked@*/
  +static short bShort = 4523;
  +/*@unchecked@*/
   static int aInt = 271828;
   /*@unchecked@*/
   static int bInt = 271828;
  @@ -126,6 +130,8 @@
   
     { "int", 'i', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT, &aInt, 0,
   	"POPT_ARG_INT: 271828", NULL },
  +  { "short", 's', POPT_ARG_SHORT | POPT_ARGFLAG_SHOW_DEFAULT, &aShort, 0,
  +	"POPT_ARG_SHORT: 4523", NULL },
     { "long", 'l', POPT_ARG_LONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLong, 0,
   	"POPT_ARG_LONG: 738905609", NULL },
     { "longlong", 'L', POPT_ARG_LONGLONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLongLong, 0,
  @@ -137,6 +143,8 @@
   
      { "randint", '\0', POPT_ARG_INT|POPT_ARGFLAG_RANDOM, &aInt, 0,
   	"POPT_ARGFLAG_RANDOM: experimental", NULL },
  +   { "randshort", '\0', POPT_ARG_SHORT|POPT_ARGFLAG_RANDOM, &aShort, 0,
  +	"POPT_ARGFLAG_RANDOM: experimental", NULL },
      { "randlong", '\0', POPT_ARG_LONG|POPT_ARGFLAG_RANDOM, &aLong, 0,
   	"POPT_ARGFLAG_RANDOM: experimental", NULL },
      { "randlonglong", '\0', POPT_ARG_LONGLONG|POPT_ARGFLAG_RANDOM, &aLongLong, 0,
  @@ -170,11 +178,11 @@
   
   static void resetVars(void)
   	/*@globals arg1, arg2, arg3, inc, shortopt,
  -		aVal, aFlag, aInt, aLong, aLongLong, aFloat, aDouble, aArgv,
  -		oStr, singleDash, pass2 @*/
  +		aVal, aFlag, aShort, aInt, aLong, aLongLong, aFloat, aDouble,
  +		aArgv, oStr, singleDash, pass2 @*/
   	/*@modifies arg1, arg2, arg3, inc, shortopt,
  -		aVal, aFlag, aInt, aLong, aLongLong, aFloat, aDouble, aArgv,
  -		oStr, singleDash, pass2 @*/
  +		aVal, aFlag, aShort, aInt, aLong, aLongLong, aFloat, aDouble,
  +		aArgv, oStr, singleDash, pass2 @*/
   {
       arg1 = 0;
       arg2 = "(none)";
  @@ -185,6 +193,7 @@
       aVal = bVal;
       aFlag = bFlag;
   
  +    aShort = bShort;
       aInt = bInt;
       aLong = bLong;
       aLongLong = bLongLong;
  @@ -277,6 +286,8 @@
   	fprintf(stdout, " aVal: %d", aVal);
       if (aFlag != bFlag)
   	fprintf(stdout, " aFlag: 0x%x", aFlag);
  +    if (aShort != bShort)
  +	fprintf(stdout, " aShort: %d", aShort);
       if (aInt != bInt)
   	fprintf(stdout, " aInt: %d", aInt);
       if (aLong != bLong)
  @@ .
  patch -p0 <<'@@ .'
  Index: popt/testit.sh
  ============================================================================
  $ cvs diff -u -r1.28 -r1.29 testit.sh
  --- popt/testit.sh	23 Jan 2009 17:41:56 -0000	1.28
  +++ popt/testit.sh	25 Jul 2009 18:52:36 -0000	1.29
  @@ -84,40 +84,43 @@
   
   run test1 "test1 - 32" "arg1: 0 arg2: (none) aInt: 123456789" -i 123456789
   run test1 "test1 - 33" "arg1: 0 arg2: (none) aInt: 123456789" --int 123456789
  -run test1 "test1 - 34" "arg1: 0 arg2: (none) aLong: 1123456789" -l 1123456789
  -run test1 "test1 - 35" "arg1: 0 arg2: (none) aLong: 1123456789" --long 1123456789
  -run test1 "test1 - 36" "arg1: 0 arg2: (none) aLongLong: 1111123456789" -L \
                1111123456789
  -run test1 "test1 - 37" "arg1: 0 arg2: (none) aLongLong: 1111123456789" --longlong \
                1111123456789
  -
  -run test1 "test1 - 38" "arg1: 0 arg2: (none) aFloat: 10.1" -f 10.1
  -run test1 "test1 - 39" "arg1: 0 arg2: (none) aFloat: 10.1" --float 10.1
  -run test1 "test1 - 40" "arg1: 0 arg2: (none) aDouble: 10.1" -d 10.1
  -run test1 "test1 - 41" "arg1: 0 arg2: (none) aDouble: 10.1" --double 10.1
  -
  -run test1 "test1 - 42" "arg1: 0 arg2: (none) oStr: (none)" --optional
  -run test1 "test1 - 43" "arg1: 0 arg2: (none) oStr: yadda" --optional=yadda
  -run test1 "test1 - 44" "arg1: 0 arg2: (none) oStr: yadda" --optional yadda
  -run test1 "test1 - 45" "arg1: 0 arg2: (none) oStr: ping rest: pong" \
                --optional=ping pong
  -run test1 "test1 - 46" "arg1: 0 arg2: (none) oStr: ping rest: pong" --optional \
                ping pong
  -run test1 "test1 - 47" "arg1: 0 arg2: (none) aArgv: A B rest: C" --argv A --argv B \
                C
  -
  -run test1 "test1 - 48" "arg1: 0 arg2: foo=bar" -2foo=bar
  -run test1 "test1 - 49" "arg1: 0 arg2: foo=bar" -2=foo=bar
  -
  -run test1 "test1 - 50" "arg1: 0 arg2: (none) aFlag: 0xfeed" --bitxor
  -run test1 "test1 - 51" "arg1: 0 arg2: (none) aFlag: 0xffff" --bitset
  -run test1 "test1 - 52" "arg1: 0 arg2: (none) aFlag: 0x28c" --bitclr
  -run test1 "test1 - 53" "arg1: 0 arg2: (none) aFlag: 0x8888" --nobitset
  -run test1 "test1 - 54" "arg1: 0 arg2: (none) aFlag: 0xface" --nobitclr
  +run test1 "test1 - 34" "arg1: 0 arg2: (none) aShort: 12345" -s 12345
  +run test1 "test1 - 35" "arg1: 0 arg2: (none) aShort: 12345" --short 12345
  +run test1 "test1 - 36" "arg1: 0 arg2: (none) aLong: 1123456789" -l 1123456789
  +run test1 "test1 - 37" "arg1: 0 arg2: (none) aLong: 1123456789" --long 1123456789
  +run test1 "test1 - 38" "arg1: 0 arg2: (none) aLongLong: 1111123456789" -L \
1111123456789  +run test1 "test1 - 39" "arg1: 0 arg2: (none) aLongLong: \
1111123456789" --longlong 1111123456789  +
  +run test1 "test1 - 40" "arg1: 0 arg2: (none) aFloat: 10.1" -f 10.1
  +run test1 "test1 - 41" "arg1: 0 arg2: (none) aFloat: 10.1" --float 10.1
  +run test1 "test1 - 42" "arg1: 0 arg2: (none) aDouble: 10.1" -d 10.1
  +run test1 "test1 - 43" "arg1: 0 arg2: (none) aDouble: 10.1" --double 10.1
  +
  +run test1 "test1 - 44" "arg1: 0 arg2: (none) oStr: (none)" --optional
  +run test1 "test1 - 45" "arg1: 0 arg2: (none) oStr: yadda" --optional=yadda
  +run test1 "test1 - 46" "arg1: 0 arg2: (none) oStr: yadda" --optional yadda
  +run test1 "test1 - 47" "arg1: 0 arg2: (none) oStr: ping rest: pong" \
--optional=ping pong  +run test1 "test1 - 48" "arg1: 0 arg2: (none) oStr: ping rest: \
pong" --optional ping pong  +run test1 "test1 - 49" "arg1: 0 arg2: (none) aArgv: A B \
rest: C" --argv A --argv B C  +
  +run test1 "test1 - 50" "arg1: 0 arg2: foo=bar" -2foo=bar
  +run test1 "test1 - 51" "arg1: 0 arg2: foo=bar" -2=foo=bar
  +
  +run test1 "test1 - 52" "arg1: 0 arg2: (none) aFlag: 0xfeed" --bitxor
  +run test1 "test1 - 53" "arg1: 0 arg2: (none) aFlag: 0xffff" --bitset
  +run test1 "test1 - 54" "arg1: 0 arg2: (none) aFlag: 0x28c" --bitclr
  +run test1 "test1 - 55" "arg1: 0 arg2: (none) aFlag: 0x8888" --nobitset
  +run test1 "test1 - 56" "arg1: 0 arg2: (none) aFlag: 0xface" --nobitclr
   
   run test1 "test1 - 55" "\
   Usage: lt-test1 [-I?] [-c|--cb2=STRING] [--arg1] [-2|--arg2=ARG]
           [-3|--arg3=ANARG] [-onedash] [--optional=STRING] [--val]
  -        [-i|--int=INT] [-l|--long=LONG] [-L|--longlong=LONGLONG]
  -        [-f|--float=FLOAT] [-d|--double=DOUBLE] [--randint=INT]
  -        [--randlong=LONG] [--randlonglong=LONGLONG] [--argv] [--bitset]
  -        [--bitclr] [--bitxor] [--nstr=STRING] [--lstr=STRING] [-I|--inc]
  -        [-c|--cb=STRING] [--longopt] [-?|--help] [--usage] [--simple=ARG]" --usage
  +        [-i|--int=INT] [-s|--short=SHORT] [-l|--long=LONG]
  +        [-L|--longlong=LONGLONG] [-f|--float=FLOAT] [-d|--double=DOUBLE]
  +        [--randint=INT] [--randshort=SHORT] [--randlong=LONG]
  +        [--randlonglong=LONGLONG] [--argv] [--bitset] [--bitclr] [--bitxor]
  +        [--nstr=STRING] [--lstr=STRING] [-I|--inc] [-c|--cb=STRING]
  +        [--longopt] [-?|--help] [--usage] [--simple=ARG]" --usage
   
   run test1 "test1 - 56" "\
   Usage: lt-test1 [OPTION...]
  @@ -131,12 +134,14 @@
                                     string argument
         --val                       POPT_ARG_VAL: 125992 141421
     -i, --int=INT                   POPT_ARG_INT: 271828 (default: 271828)
  +  -s, --short=SHORT               POPT_ARG_SHORT: 4523 (default: 4523)
     -l, --long=LONG                 POPT_ARG_LONG: 738905609 (default: 738905609)
     -L, --longlong=LONGLONG         POPT_ARG_LONGLONG: 738905609 (default:
                                     738905609)
     -f, --float=FLOAT               POPT_ARG_FLOAT: 3.14159 (default: 3.14159)
     -d, --double=DOUBLE             POPT_ARG_DOUBLE: 9.8696 (default: 9.8696)
         --randint=INT               POPT_ARGFLAG_RANDOM: experimental
  +      --randshort=SHORT           POPT_ARGFLAG_RANDOM: experimental
         --randlong=LONG             POPT_ARGFLAG_RANDOM: experimental
         --randlonglong=LONGLONG     POPT_ARGFLAG_RANDOM: experimental
         --argv                      POPT_ARG_ARGV: append arg to array (can be
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic