Linux: Added thread safe getopt
The getopt command uses global variables and is not thread safe.
Created a minimal px4_getopt version that supports options with
or without an arg, and random placement of options on the command line.
This version modifies the order of the args in argv as does the
POSIX version of getopt.
This assumes that argv[0] is the program name. Nuttx may not support
that properly in task_spawn.
Signed-off-by:
Mark Charlebois <charlebm@gmail.com>
Showing
- makefiles/linux.mk 3 additions, 1 deletionmakefiles/linux.mk
- src/drivers/ms5611/ms5611_linux.cpp 3 additions, 16 deletionssrc/drivers/ms5611/ms5611_linux.cpp
- src/modules/mavlink/mavlink_main_linux.cpp 12 additions, 13 deletionssrc/modules/mavlink/mavlink_main_linux.cpp
- src/platforms/common/module.mk 6 additions, 0 deletionssrc/platforms/common/module.mk
- src/platforms/common/px4_getopt.c 152 additions, 0 deletionssrc/platforms/common/px4_getopt.c
- src/platforms/linux/drivers/accel/accel.cpp 13 additions, 6 deletionssrc/platforms/linux/drivers/accel/accel.cpp
- src/platforms/px4_getopt.h 46 additions, 0 deletionssrc/platforms/px4_getopt.h
Loading
Please register or sign in to comment