[PATCH 7/9] Patching STTY command for use in RTEMS

Kevin Kirspel kevin-kirspel at idexx.com
Thu Feb 9 03:21:38 UTC 2017


---
 freebsd/bin/stty/cchar.c                      | 11 ++++
 freebsd/bin/stty/gfmt.c                       | 22 ++++++++
 freebsd/bin/stty/key.c                        | 21 ++++++++
 freebsd/bin/stty/modes.c                      |  9 ++++
 freebsd/bin/stty/print.c                      | 14 +++++
 freebsd/bin/stty/rtems-bsd-stty-cchar-data.h  |  4 ++
 freebsd/bin/stty/rtems-bsd-stty-data.h        | 11 ++++
 freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h   |  4 ++
 freebsd/bin/stty/rtems-bsd-stty-key-data.h    |  5 ++
 freebsd/bin/stty/rtems-bsd-stty-modes-data.h  |  4 ++
 freebsd/bin/stty/rtems-bsd-stty-namespace.h   | 34 ++++++++++++
 freebsd/bin/stty/rtems-bsd-stty-print-data.h  |  6 +++
 freebsd/bin/stty/rtems-bsd-stty-stty-data.h   |  4 ++
 freebsd/bin/stty/rtems-bsd-stty-util-data.h   |  4 ++
 freebsd/bin/stty/stty.c                       | 78 +++++++++++++++++++++++++++
 freebsd/bin/stty/stty.h                       | 12 +++++
 freebsd/bin/stty/util.c                       |  9 ++++
 rtemsbsd/include/machine/rtems-bsd-commands.h |  2 +
 rtemsbsd/include/rtems/netcmds-config.h       |  2 +
 19 files changed, 256 insertions(+)
 mode change 100644 => 100755 freebsd/bin/stty/cchar.c
 mode change 100644 => 100755 freebsd/bin/stty/gfmt.c
 mode change 100644 => 100755 freebsd/bin/stty/key.c
 mode change 100644 => 100755 freebsd/bin/stty/modes.c
 mode change 100644 => 100755 freebsd/bin/stty/print.c
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-cchar-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-key-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-modes-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-namespace.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-print-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-stty-data.h
 create mode 100755 freebsd/bin/stty/rtems-bsd-stty-util-data.h
 mode change 100644 => 100755 freebsd/bin/stty/stty.c
 mode change 100644 => 100755 freebsd/bin/stty/stty.h
 mode change 100644 => 100755 freebsd/bin/stty/util.c
 mode change 100644 => 100755 rtemsbsd/include/machine/rtems-bsd-commands.h
 mode change 100644 => 100755 rtemsbsd/include/rtems/netcmds-config.h

diff --git a/freebsd/bin/stty/cchar.c b/freebsd/bin/stty/cchar.c
old mode 100644
new mode 100755
index a6bdeb5..f46204c
--- a/freebsd/bin/stty/cchar.c
+++ b/freebsd/bin/stty/cchar.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)cchar.c	8.5 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 
 #include <err.h>
@@ -47,6 +53,9 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-cchar-data.h"
+#endif /* __rtems__ */
 
 static int c_cchar(const void *, const void *);
 
@@ -59,7 +68,9 @@ static int c_cchar(const void *, const void *);
  */
 struct cchar cchars1[] = {
 	{ "discard",	VDISCARD, 	CDISCARD },
+#ifndef __rtems__
 	{ "dsusp", 	VDSUSP,		CDSUSP },
+#endif /* __rtems__ */
 	{ "eof",	VEOF,		CEOF },
 	{ "eol",	VEOL,		CEOL },
 	{ "eol2",	VEOL2,		CEOL },
diff --git a/freebsd/bin/stty/gfmt.c b/freebsd/bin/stty/gfmt.c
old mode 100644
new mode 100755
index 6670e2d..f8839ba
--- a/freebsd/bin/stty/gfmt.c
+++ b/freebsd/bin/stty/gfmt.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)gfmt.c	8.6 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 
 #include <err.h>
@@ -45,6 +51,9 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-gfmt-data.h"
+#endif /* __rtems__ */
 
 static void gerr(const char *s) __dead2;
 
@@ -67,8 +76,13 @@ gprint(struct termios *tp, struct winsize *wp __unused, int ldisc __unused)
 	    (u_long)tp->c_oflag);
 	for (cp = cchars1; cp->name; ++cp)
 		(void)printf("%s=%x:", cp->name, tp->c_cc[cp->sub]);
+#ifndef __rtems__
 	(void)printf("ispeed=%lu:ospeed=%lu\n",
 	    (u_long)cfgetispeed(tp), (u_long)cfgetospeed(tp));
+#else /* __rtems__ */
+  (void)printf("ispeed=%lu:ospeed=%lu\n",
+      (u_long)rtems_bsd_get_input_speed(tp), (u_long)rtems_bsd_get_output_speed(tp));
+#endif /* __rtems__ */
 }
 
 void
@@ -100,7 +114,11 @@ gread(struct termios *tp, char *s)
 		}
 		if (CHK("ispeed")) {
 			(void)sscanf(ep, "%ld", &tmp);
+#ifndef __rtems__
 			tp->c_ispeed = tmp;
+#else /* __rtems__ */
+			cfsetispeed(tp, rtems_bsd_bsd_speed_to_rtems_speed(tmp));
+#endif /* __rtems__ */
 			continue;
 		}
 		if (CHK("lflag")) {
@@ -113,7 +131,11 @@ gread(struct termios *tp, char *s)
 		}
 		if (CHK("ospeed")) {
 			(void)sscanf(ep, "%ld", &tmp);
+#ifndef __rtems__
 			tp->c_ospeed = tmp;
+#else /* __rtems__ */
+			cfsetospeed(tp, rtems_bsd_bsd_speed_to_rtems_speed(tmp));
+#endif /* __rtems__ */
 			continue;
 		}
 		for (cp = cchars1; cp->name != NULL; ++cp)
diff --git a/freebsd/bin/stty/key.c b/freebsd/bin/stty/key.c
old mode 100644
new mode 100755
index effe6ab..d00a180
--- a/freebsd/bin/stty/key.c
+++ b/freebsd/bin/stty/key.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)key.c	8.3 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 
 #include <err.h>
@@ -96,6 +102,9 @@ static struct key {
 	{ "speed",	f_speed,	0 },
 	{ "tty",	f_tty,		0 },
 };
+#ifdef __rtems__
+#include "rtems-bsd-stty-key-data.h"
+#endif /* __rtems__ */
 
 static int
 c_key(const void *a, const void *b)
@@ -208,7 +217,11 @@ void
 f_ispeed(struct info *ip)
 {
 
+#ifndef __rtems__
 	cfsetispeed(&ip->t, (speed_t)atoi(ip->arg));
+#else /* __rtems__ */
+	cfsetispeed(&ip->t, rtems_bsd_bsd_speed_to_rtems_speed((speed_t)atoi(ip->arg)));
+#endif /* __rtems__ */
 	ip->set = 1;
 }
 
@@ -230,7 +243,11 @@ void
 f_ospeed(struct info *ip)
 {
 
+#ifndef __rtems__
 	cfsetospeed(&ip->t, (speed_t)atoi(ip->arg));
+#else /* __rtems__ */
+	cfsetospeed(&ip->t, rtems_bsd_bsd_speed_to_rtems_speed((speed_t)atoi(ip->arg)));
+#endif /* __rtems__ */
 	ip->set = 1;
 }
 
@@ -282,7 +299,11 @@ void
 f_speed(struct info *ip)
 {
 
+#ifndef __rtems__
 	(void)printf("%lu\n", (u_long)cfgetospeed(&ip->t));
+#else /* __rtems__ */
+	(void)printf("%lu\n", (u_long)rtems_bsd_get_output_speed(&ip->t));
+#endif /* __rtems__ */
 }
 
 void
diff --git a/freebsd/bin/stty/modes.c b/freebsd/bin/stty/modes.c
old mode 100644
new mode 100755
index 1299866..a446b94
--- a/freebsd/bin/stty/modes.c
+++ b/freebsd/bin/stty/modes.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,10 +40,16 @@ static char sccsid[] = "@(#)modes.c	8.3 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 #include <stddef.h>
 #include <string.h>
 #include "stty.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-modes-data.h"
+#endif /* __rtems__ */
 
 int msearch(char ***, struct info *);
 
diff --git a/freebsd/bin/stty/print.c b/freebsd/bin/stty/print.c
old mode 100644
new mode 100755
index f1313a1..fecf5c3
--- a/freebsd/bin/stty/print.c
+++ b/freebsd/bin/stty/print.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 
 #include <stddef.h>
@@ -45,6 +51,9 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-print-data.h"
+#endif /* __rtems__ */
 
 static void  binit(const char *);
 static void  bput(const char *);
@@ -77,8 +86,13 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
 	}
 
 	/* Line speed. */
+#ifndef __rtems__
 	ispeed = cfgetispeed(tp);
 	ospeed = cfgetospeed(tp);
+#else /* __rtems__ */
+	ispeed = rtems_bsd_get_input_speed(tp);
+	ospeed = rtems_bsd_get_output_speed(tp);
+#endif /* __rtems__ */
 	if (ispeed != ospeed)
 		cnt +=
 		    printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
diff --git a/freebsd/bin/stty/rtems-bsd-stty-cchar-data.h b/freebsd/bin/stty/rtems-bsd-stty-cchar-data.h
new file mode 100755
index 0000000..19661a7
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-cchar-data.h
@@ -0,0 +1,4 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* cchar.c */
diff --git a/freebsd/bin/stty/rtems-bsd-stty-data.h b/freebsd/bin/stty/rtems-bsd-stty-data.h
new file mode 100755
index 0000000..8bad70a
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-data.h
@@ -0,0 +1,11 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+/* cchar.c */
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_stty, extern struct cchar cchars1[]);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_stty, extern struct cchar cchars2[]);
+/* gfmt.c */
+/* key.c */
+/* modes.c */
+/* print.c */
+/* stty.c */
+/* util.c */
diff --git a/freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h b/freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h
new file mode 100755
index 0000000..f2c1358
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h
@@ -0,0 +1,4 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* gfmt.c */
diff --git a/freebsd/bin/stty/rtems-bsd-stty-key-data.h b/freebsd/bin/stty/rtems-bsd-stty-key-data.h
new file mode 100755
index 0000000..848ee78
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-key-data.h
@@ -0,0 +1,5 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* key.c */
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_stty, static struct key keys[20]);
diff --git a/freebsd/bin/stty/rtems-bsd-stty-modes-data.h b/freebsd/bin/stty/rtems-bsd-stty-modes-data.h
new file mode 100755
index 0000000..29762ce
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-modes-data.h
@@ -0,0 +1,4 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* modes.c */
diff --git a/freebsd/bin/stty/rtems-bsd-stty-namespace.h b/freebsd/bin/stty/rtems-bsd-stty-namespace.h
new file mode 100755
index 0000000..c927248
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-namespace.h
@@ -0,0 +1,34 @@
+/* generated by userspace-header-gen.py */
+/* cchar.c */
+#define cchars1 _bsd_stty_cchars1
+#define cchars2 _bsd_stty_cchars2
+#define csearch _bsd_stty_csearch
+/* gfmt.c */
+#define gread _bsd_stty_gread
+#define gprint _bsd_stty_gprint
+/* key.c */
+#define f_tty _bsd_stty_f_tty
+#define f_speed _bsd_stty_f_speed
+#define f_size _bsd_stty_f_size
+#define f_sane _bsd_stty_f_sane
+#define f_rows _bsd_stty_f_rows
+#define f_raw _bsd_stty_f_raw
+#define f_ospeed _bsd_stty_f_ospeed
+#define f_nl _bsd_stty_f_nl
+#define f_ispeed _bsd_stty_f_ispeed
+#define f_extproc _bsd_stty_f_extproc
+#define f_everything _bsd_stty_f_everything
+#define f_ek _bsd_stty_f_ek
+#define f_dec _bsd_stty_f_dec
+#define f_columns _bsd_stty_f_columns
+#define f_cbreak _bsd_stty_f_cbreak
+#define f_all _bsd_stty_f_all
+#define ksearch _bsd_stty_ksearch
+/* modes.c */
+#define msearch _bsd_stty_msearch
+/* print.c */
+#define print _bsd_stty_print
+/* stty.c */
+#define usage _bsd_stty_usage
+/* util.c */
+#define checkredirect _bsd_stty_checkredirect
diff --git a/freebsd/bin/stty/rtems-bsd-stty-print-data.h b/freebsd/bin/stty/rtems-bsd-stty-print-data.h
new file mode 100755
index 0000000..fb6d0e6
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-print-data.h
@@ -0,0 +1,6 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* print.c */
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_stty, static int col);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_stty, static char const *label);
diff --git a/freebsd/bin/stty/rtems-bsd-stty-stty-data.h b/freebsd/bin/stty/rtems-bsd-stty-stty-data.h
new file mode 100755
index 0000000..c325685
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-stty-data.h
@@ -0,0 +1,4 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* stty.c */
diff --git a/freebsd/bin/stty/rtems-bsd-stty-util-data.h b/freebsd/bin/stty/rtems-bsd-stty-util-data.h
new file mode 100755
index 0000000..146095b
--- /dev/null
+++ b/freebsd/bin/stty/rtems-bsd-stty-util-data.h
@@ -0,0 +1,4 @@
+/* generated by userspace-header-gen.py */
+#include <rtems/linkersets.h>
+#include "rtems-bsd-stty-data.h"
+/* util.c */
diff --git a/freebsd/bin/stty/stty.c b/freebsd/bin/stty/stty.c
old mode 100644
new mode 100755
index 54c63f6..3999a7f
--- a/freebsd/bin/stty/stty.c
+++ b/freebsd/bin/stty/stty.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1989, 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -43,6 +46,12 @@ static char sccsid[] = "@(#)stty.c	8.3 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#define __need_getopt_newlib
+#include <getopt.h>
+#include <machine/rtems-bsd-program.h>
+#include <machine/rtems-bsd-commands.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 
 #include <ctype.h>
@@ -57,20 +66,56 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-stty-data.h"
+#endif /* __rtems__ */
+
+#ifdef __rtems__
+static int main(int argc, char *argv[]);
+
+RTEMS_LINKER_RWSET(bsd_prog_stty, char);
 
 int
+rtems_bsd_command_stty(int argc, char *argv[])
+{
+  int exit_code;
+  void *data_begin;
+  size_t data_size;
+
+  data_begin = RTEMS_LINKER_SET_BEGIN(bsd_prog_stty);
+  data_size = RTEMS_LINKER_SET_SIZE(bsd_prog_stty);
+
+  rtems_bsd_program_lock();
+  exit_code = rtems_bsd_program_call_main_with_data_restore("stty",
+      main, argc, argv, data_begin, data_size);
+  rtems_bsd_program_unlock();
+
+  return exit_code;
+}
+#endif /* __rtems__ */
+int
 main(int argc, char *argv[])
 {
 	struct info i;
 	enum FMT fmt;
 	int ch;
 	const char *file, *errstr = NULL;
+#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__ */
 
 	fmt = NOTSET;
 	i.fd = STDIN_FILENO;
 	file = "stdin";
 
 	opterr = 0;
+#ifndef __rtems__
 	while (optind < argc &&
 	    strspn(argv[optind], "-aefg") == strlen(argv[optind]) &&
 	    (ch = getopt(argc, argv, "aef:g")) != -1)
@@ -93,6 +138,34 @@ main(int argc, char *argv[])
 		default:
 			goto args;
 		}
+#else /* __rtems__ */
+	while (optind < argc && (ch = getopt(argc, argv, "aef:g")) != -1) {
+		int optidx = optind - ((optarg == 0) ? 1 : 2);
+		if(strspn(argv[optidx], "-aefg") == strlen(argv[optidx])) {
+			switch(ch) {
+			case 'a':   /* undocumented: POSIX compatibility */
+				fmt = POSIX;
+				break;
+			case 'e':
+				fmt = BSD;
+				break;
+			case 'f':
+				if ((i.fd = open(optarg, O_RDONLY | O_NONBLOCK)) < 0)
+					err(1, "%s", optarg);
+				file = optarg;
+				break;
+			case 'g':
+				fmt = GFLAG;
+				break;
+			case '?':
+			default:
+				goto args;
+			}
+		} else {
+			break;
+		}
+	}
+#endif /* __rtems__ */
 
 args:	argc -= optind;
 	argv += optind;
@@ -136,8 +209,13 @@ args:	argc -= optind;
 			speed = strtonum(*argv, 0, UINT_MAX, &errstr);
 			if (errstr)
 				err(1, "speed");
+#ifndef __rtems__
 			cfsetospeed(&i.t, speed);
 			cfsetispeed(&i.t, speed);
+#else /* __rtems__ */
+			cfsetospeed(&i.t, rtems_bsd_bsd_speed_to_rtems_speed(speed));
+			cfsetispeed(&i.t, rtems_bsd_bsd_speed_to_rtems_speed(speed));
+#endif /* __rtems__ */
 			i.set = 1;
 			continue;
 		}
diff --git a/freebsd/bin/stty/stty.h b/freebsd/bin/stty/stty.h
old mode 100644
new mode 100755
index 77b8522..bfb93ff
--- a/freebsd/bin/stty/stty.h
+++ b/freebsd/bin/stty/stty.h
@@ -31,7 +31,19 @@
  */
 
 #include <sys/ioctl.h>
+#ifndef __rtems__
 #include <termios.h>
+#else /* __rtems__ */
+#include <sys/cdefs.h>
+#include <sys/_termios.h>
+#include <sys/_types.h>
+#include <sys/ttycom.h>
+#include <sys/ttydefaults.h>
+
+#define OXTABS    TAB3
+#define MDMBUF    CCAR_OFLOW
+
+#endif /* __rtems__ */
 
 struct info {
 	int fd;					/* file descriptor */
diff --git a/freebsd/bin/stty/util.c b/freebsd/bin/stty/util.c
old mode 100644
new mode 100755
index 69a20f0..49acd0f
--- a/freebsd/bin/stty/util.c
+++ b/freebsd/bin/stty/util.c
@@ -1,5 +1,8 @@
 #include <machine/rtems-bsd-user-space.h>
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)util.c	8.3 (Berkeley) 4/2/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -47,6 +53,9 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-util-data.h"
+#endif /* __rtems__ */
 
 /*
  * Gross, but since we're changing the control descriptor from 1 to 0, most
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h b/rtemsbsd/include/machine/rtems-bsd-commands.h
old mode 100644
new mode 100755
index c0524c8..3b91824
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -69,6 +69,8 @@ int rtems_bsd_command_sysctl(int argc, char **argv);
 int rtems_bsd_command_vmstat(int argc, char **argv);
 
 int rtems_bsd_command_wlanstats(int argc, char **argv);
+
+int rtems_bsd_command_stty(int argc, char **argv);
 
 __END_DECLS
 
diff --git a/rtemsbsd/include/rtems/netcmds-config.h b/rtemsbsd/include/rtems/netcmds-config.h
old mode 100644
new mode 100755
index b3bc66f..773c31f
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -44,6 +44,8 @@ extern rtems_shell_cmd_t rtems_shell_SYSCTL_Command;
 extern rtems_shell_cmd_t rtems_shell_VMSTAT_Command;
 
 extern rtems_shell_cmd_t rtems_shell_WLANSTATS_Command;
+
+extern rtems_shell_cmd_t rtems_shell_STTY_Command;
 
 #ifdef __cplusplus
 }
-- 
1.9.1



More information about the devel mailing list