summaryrefslogtreecommitdiff
path: root/test1.c
diff options
context:
space:
mode:
authorjbj <jbj>2000-09-11 17:09:32 +0000
committerjbj <jbj>2000-09-11 17:09:32 +0000
commit4a96408516a91ea82df080568e960fad643cbbcc (patch)
treeef93662d6cc8feb15bc73a1bc165f61a2a6bf2fe /test1.c
parent56a8f0e55a92ef6bc6313ecc253c37db68aa2b63 (diff)
downloadlibpopt-4a96408516a91ea82df080568e960fad643cbbcc.tar.gz
- popt: support for float/double args.
Diffstat (limited to 'test1.c')
-rw-r--r--test1.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test1.c b/test1.c
index 416d59e..fdd3a4a 100644
--- a/test1.c
+++ b/test1.c
@@ -17,6 +17,8 @@ char * arg2 = "(none)";
int arg3 = 0;
int inc = 0;
int shortopt = 0;
+float aFloat = 0.0;
+double aDouble = 0.0;
int singleDash = 0;
static struct poptOption moreCallbackArgs[] = {
@@ -48,6 +50,10 @@ static struct poptOption options[] = {
"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" },
@@ -62,6 +68,8 @@ static void resetVars(void)
arg3 = 0;
inc = 0;
shortopt = 0;
+ aFloat = 0.0;
+ aDouble = 0.0;
singleDash = 0;
pass2 = 0;
}
@@ -116,6 +124,10 @@ int main(int argc, const char ** argv) {
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, " -");