- fix: preserve cpio errno when using Fclose with libio.
- fix: initialize sigs everywhere in python header object.
- translate rpm.8 man page (Peter Ivanyi <ivanyi@internet.sk>).
+ - popt: support for float/double args.
3.0.4 -> 3.0.5
- configure.in fiddles for BSD systems (Patrick Schoo).
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-08-27 14:45-0400\n"
+"POT-Creation-Date: 2000-09-11 12:53-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
POPT_ARG_INT An integer argument is expected int
POPT_ARG_LONG A long integer is expected long
POPT_ARG_VAL Integer value taken from \f(CWval\fR int
+POPT_ARG_FLOAT An float argument is expected float
+POPT_ARG_DOUBLE A double argument is expected double
.TE
.sp
For numeric values, if the \fIargInfo\fR value is bitwise or'd with one of
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 " arguments, but "
-.BR POPT_ARG_INT " and " POPT_ARG_LONG " are converted to the
-appropriate type, and an error returned if the conversion fails.
+.BR POPT_ARG_INT ", " POPT_ARG_LONG ", " POPT_ARG_FLOAT ", and "
+.BR POPT_ARG_DOUBLE " are converted to the appropriate type, and an "
+error returned if the conversion fails.
.sp
\fBPOPT_ARG_VAL\fR causes \fIarg\fP to be set to the (integer) value of
\fIval\fP when the argument is found. This is most often useful for
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 " or " POPT_ARG_LONG .
+.BR POPT_ARG_INT ", " POPT_ARG_LONG ", "
+.RB POPT_ARG_FLOAT ", or " POPT_ARG_DOUBLE "."
.sp
.TP
.B POPT_ERROR_OVERFLOW
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 " or " POPT_ARG_LONG .
+.RB "argument of type " POPT_ARG_INT ", " POPT_ARG_LONG ", "
+.RB POPT_ARG_FLOAT ", or " POPT_ARG_DOUBLE "."
.sp
.TP
.B POPT_ERROR_ERRNO
#undef MYDEBUG
#include "system.h"
+
+#include <math.h>
+
#include "findme.h"
#include "poptint.h"
if (poptSaveInt(opt, aLong))
return POPT_ERROR_BADOPERATION;
}
- } break;
+ } break;
+
+ case POPT_ARG_FLOAT:
+ case POPT_ARG_DOUBLE:
+ { long aDouble;
+ char *end;
+
+ aDouble = strtod(con->os->nextArg, &end);
+ if (*end)
+ return POPT_ERROR_BADNUMBER;
+ if (aDouble == +HUGE_VAL || aDouble == -HUGE_VAL)
+ return POPT_ERROR_OVERFLOW;
+ if (aDouble == 0.0 && errno == ERANGE)
+ return POPT_ERROR_OVERFLOW;
+ if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_DOUBLE) {
+ *((double *) opt->arg) = aDouble;
+ } else {
+#ifdef ABS
+#undef ABS
+#endif
+#define ABS(a) (((a) < 0) ? -(a) : (a))
+ if (ABS(aDouble) > FLT_MAX)
+ return POPT_ERROR_OVERFLOW;
+ if (ABS(aDouble) < FLT_MIN)
+ return POPT_ERROR_OVERFLOW;
+ *((float *) opt->arg) = aDouble;
+ }
+ } break;
default:
fprintf(stdout, POPT_("option type (%d) not implemented in popt\n"),
opt->argInfo & POPT_ARG_MASK);
included tables; arg points
to the domain string */
#define POPT_ARG_VAL 7 /* arg should take value val */
+#define POPT_ARG_FLOAT 8 /* arg should be converted to float */
+#define POPT_ARG_DOUBLE 9 /* arg should be converted to double */
#define POPT_ARG_MASK 0x0000FFFF
#define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */
int arg3 = 0;
int inc = 0;
int shortopt = 0;
+float aFloat = 0.0;
+double aDouble = 0.0;
int singleDash = 0;
static struct poptOption moreCallbackArgs[] = {
"This shouldn't show up", NULL },
{ "unused", '\0', POPT_ARG_STRING, NULL, 0,
"Unused option for help testing", "UNUSED" },
+ { "float", 'f', POPT_ARG_FLOAT, &aFloat, 0,
+ "A float argument", "FLOAT" },
+ { "double", 'd', POPT_ARG_DOUBLE, &aDouble, 0,
+ "A double argument", "DOUBLE" },
{ NULL, '-', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &singleDash, 0 },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, &moreArgs, 0, NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, &callbackArgs, 0, "Callback arguments" },
arg3 = 0;
inc = 0;
shortopt = 0;
+ aFloat = 0.0;
+ aDouble = 0.0;
singleDash = 0;
pass2 = 0;
}
fprintf(stdout, " inc: %d", inc);
if (shortopt)
fprintf(stdout, " short: %d", shortopt);
+ if (aFloat != 0.0)
+ fprintf(stdout, " aFloat: %g", aFloat);
+ if (aDouble != 0.0)
+ fprintf(stdout, " aDouble: %g", aDouble);
if (singleDash)
fprintf(stdout, " -");
run test1 "test1 - 30" "arg1: 0 arg2: 'foo bingo' rest: boggle" --grab bingo boggle
run test1 "test1 - 31" "arg1: 0 arg2: 'foo bar' rest: boggle" --grabbar boggle
+run test1 "test1 - 32" "arg1: 0 arg2: (none) aFloat: 10.1" -f 10.1
+run test1 "test1 - 33" "arg1: 0 arg2: (none) aFloat: 10.1" --float 10.1
+run test1 "test1 - 34" "arg1: 0 arg2: (none) aDouble: 10.1" -d 10.1
+run test1 "test1 - 35" "arg1: 0 arg2: (none) aDouble: 10.1" --double 10.1
+
echo ""
echo "Passed."