aboutsummaryrefslogtreecommitdiff
path: root/apps/mavlink
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-10-14 23:09:48 -0700
committerpx4dev <px4@purgatory.org>2012-10-14 23:09:48 -0700
commitae296175435f28b5480902fdf60f37e0c6de95ff (patch)
tree4d483a7be56f62aeff62eb5dc85357d807aa6419 /apps/mavlink
parentcf6e763c58b3934b93068c029add5842c47c52c5 (diff)
downloadpx4-firmware-ae296175435f28b5480902fdf60f37e0c6de95ff.tar.gz
px4-firmware-ae296175435f28b5480902fdf60f37e0c6de95ff.tar.bz2
px4-firmware-ae296175435f28b5480902fdf60f37e0c6de95ff.zip
No joy with getopt_long
Diffstat (limited to 'apps/mavlink')
-rw-r--r--apps/mavlink/mavlink.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/apps/mavlink/mavlink.c b/apps/mavlink/mavlink.c
index 3bb70973d..e893ea951 100644
--- a/apps/mavlink/mavlink.c
+++ b/apps/mavlink/mavlink.c
@@ -62,7 +62,6 @@
#include <systemlib/param/param.h>
#include <systemlib/systemlib.h>
#include <systemlib/err.h>
-#include <systemlib/getopt_long.h>
#include "waypoints.h"
#include "mavlink_log.h"
@@ -490,19 +489,15 @@ void mavlink_update_system(void)
*/
int mavlink_thread_main(int argc, char *argv[])
{
- static GETOPT_LONG_OPTION_T options[] = {
- {"baud", REQUIRED_ARG, NULL, 'b'},
- {"speed", REQUIRED_ARG, NULL, 'b'},
- {"device", REQUIRED_ARG, NULL, 'd'},
- {"exit-allowed", NO_ARG, NULL, 'e'},
- {"onboard", NO_ARG, NULL, 'o'}
- };
-
- int ch, longind;
+ int ch;
char *device_name = "/dev/ttyS1";
baudrate = 57600;
- while ((ch = getopt_long(argc, argv, "b:d:eo", options, &longind)) != EOF) {
+ /* work around some stupidity in task_create's argv handling */
+ argc -= 2;
+ argv += 2;
+
+ while ((ch = getopt(argc, argv, "b:d:eo")) != EOF) {
switch (ch) {
case 'b':
baudrate = strtoul(optarg, NULL, 10);
@@ -692,7 +687,7 @@ int mavlink_thread_main(int argc, char *argv[])
static void
usage()
{
- fprintf(stderr, "usage: mavlink start [--device <devicename>] [--speed <device speed>] [--exit-allowed] [--onboard]\n"
+ fprintf(stderr, "usage: mavlink start [-d <devicename>] [-b <baud rate>] [-e] [-o]\n"
" mavlink stop\n"
" mavlink status\n");
exit(1);
@@ -716,7 +711,7 @@ int mavlink_main(int argc, char *argv[])
SCHED_PRIORITY_DEFAULT,
6000,
mavlink_thread_main,
- NULL);
+ argv);
exit(0);
}