From deeefe5dd17c58e95258103701915c39ea325803 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 10 Aug 2016 06:19:59 -1000 Subject: [PATCH] Describe the issues that requires the +=2 on arg[c|v] for NuttX (#5293) This may be moot and should be revisited if only px4_getops is used, but this pr politely documents the reson for the logic. --- src/modules/mavlink/mavlink_main.cpp | 2 +- src/modules/sdlog2/sdlog2.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 3818ddf818..0fd7016a33 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1634,7 +1634,7 @@ Mavlink::task_main(int argc, char *argv[]) /* the NuttX optarg handler does not * ignore argv[0] like the POSIX handler * does, nor does it deal with non-flag - * verbs well. Remove the application + * verbs well. So we remove the application * name and the verb. */ argc -= 2; diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index e0815b7a3a..6a82e84011 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -977,7 +977,12 @@ int sdlog2_thread_main(int argc, char *argv[]) flag_system_armed = false; #ifdef __PX4_NUTTX - /* work around some stupidity in NuttX's task_create's argv handling */ + /* the NuttX optarg handler does not + * ignore argv[0] like the POSIX handler + * does, nor does it deal with non-flag + * verbs well. So we Remove the application + * name and the verb. + */ argc -= 2; argv += 2; #endif