[rtems-libbsd commit] SYSCTL(8): Fix command line option processing

Sebastian Huber sebh at rtems.org
Tue Feb 14 10:56:20 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    a7391903330cf0e5cfa1fe83420e841d2e1b94fc
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=a7391903330cf0e5cfa1fe83420e841d2e1b94fc

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Feb 14 11:55:18 2017 +0100

SYSCTL(8): Fix command line option processing

---

 freebsd/sbin/sysctl/sysctl.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/freebsd/sbin/sysctl/sysctl.c b/freebsd/sbin/sysctl/sysctl.c
index ef6e8c3..1c74803 100644
--- a/freebsd/sbin/sysctl/sysctl.c
+++ b/freebsd/sbin/sysctl/sysctl.c
@@ -178,6 +178,15 @@ main(int argc, char **argv)
 {
 	int ch;
 	int warncount = 0;
+#ifdef __rtems__
+	struct getopt_data getopt_data;
+	memset(&getopt_data, 0, sizeof(getopt_data));
+#define optind getopt_data.optind
+#define optarg getopt_data.optarg
+#define opterr getopt_data.opterr
+#define optopt getopt_data.optopt
+#define getopt(argc, argv, opt) getopt_r(argc, argv, "+" opt, &getopt_data)
+#endif /* __rtems__ */
 
 	setlocale(LC_NUMERIC, "");
 	setbuf(stdout,0);




More information about the vc mailing list