aboutsummaryrefslogtreecommitdiff
path: root/apps/systemlib/getopt_long.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-09-10 00:16:30 -0700
committerpx4dev <px4@purgatory.org>2012-09-10 00:16:30 -0700
commitb1767480d2a0930c60ca59b1b047a9018663556b (patch)
tree455b19d0a546bd212ff37399cd4cd763f0939c0a /apps/systemlib/getopt_long.c
parent68d4a26b9ead5a042edb14dd5c038df2908ea7fe (diff)
downloadpx4-firmware-b1767480d2a0930c60ca59b1b047a9018663556b.tar.gz
px4-firmware-b1767480d2a0930c60ca59b1b047a9018663556b.tar.bz2
px4-firmware-b1767480d2a0930c60ca59b1b047a9018663556b.zip
Some fixes for getopt_long
Diffstat (limited to 'apps/systemlib/getopt_long.c')
-rw-r--r--apps/systemlib/getopt_long.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/systemlib/getopt_long.c b/apps/systemlib/getopt_long.c
index 662d73ff1..27c38635f 100644
--- a/apps/systemlib/getopt_long.c
+++ b/apps/systemlib/getopt_long.c
@@ -87,9 +87,7 @@ gpietsch@comcast.net
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef GETOPT_H
#include "getopt_long.h"
-#endif
/* macros */
@@ -143,8 +141,8 @@ is_option (char *argv_element, int only)
/* getopt_internal: the function that does all the dirty work */
static int
-getopt_internal (int argc, char **argv, char *shortopts,
- GETOPT_LONG_OPTION_T * longopts, int *longind, int only)
+getopt_internal (int argc, char **argv, const char *shortopts,
+ const GETOPT_LONG_OPTION_T * longopts, int *longind, int only)
{
GETOPT_ORDERING_T ordering = PERMUTE;
static size_t optwhere = 0;
@@ -178,7 +176,7 @@ getopt_internal (int argc, char **argv, char *shortopts,
shortopts++;
}
else
- ordering = (getenv ("POSIXLY_CORRECT") != NULL) ? REQUIRE_ORDER : PERMUTE;
+ ordering = /*(getenv ("POSIXLY_CORRECT") != NULL) ? REQUIRE_ORDER :*/ PERMUTE;
/*
* based on ordering, find our next option, if we're at the beginning of
@@ -381,22 +379,24 @@ getopt_internal (int argc, char **argv, char *shortopts,
return optopt;
}
+#if 0
int
getopt (int argc, char **argv, char *optstring)
{
return getopt_internal (argc, argv, optstring, NULL, NULL, 0);
}
+#endif
int
-getopt_long (int argc, char **argv, char *shortopts,
- GETOPT_LONG_OPTION_T * longopts, int *longind)
+getopt_long (int argc, char **argv, const char *shortopts,
+ const GETOPT_LONG_OPTION_T * longopts, int *longind)
{
return getopt_internal (argc, argv, shortopts, longopts, longind, 0);
}
int
-getopt_long_only (int argc, char **argv, char *shortopts,
- GETOPT_LONG_OPTION_T * longopts, int *longind)
+getopt_long_only (int argc, char **argv, const char *shortopts,
+ const GETOPT_LONG_OPTION_T * longopts, int *longind)
{
return getopt_internal (argc, argv, shortopts, longopts, longind, 1);
}