1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

Cosmetic changes to sync up the style of the patch to that of the

original code.
This commit is contained in:
Cy Schubert 2007-01-04 16:33:37 +00:00
parent 3d183e1bc1
commit 79de3eecfd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=181424
3 changed files with 81 additions and 75 deletions

View File

@ -1,5 +1,5 @@
--- src/sudosh.c.orig Sun Jun 12 18:13:15 2005
+++ src/sudosh.c Thu Jun 16 21:02:50 2005
--- src/sudosh.c.orig Sun Jun 12 19:35:07 2005
+++ src/sudosh.c Thu Jan 4 08:29:43 2007
@@ -28,6 +28,13 @@
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
@ -14,24 +14,26 @@
static struct termios termorig;
static struct winsize winorig;
@@ -554,19 +561,43 @@
@@ -545,19 +552,45 @@
{
char *sname;
+#ifdef __FreeBSD__
+#define PTYLEN 16
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1) {
+ perror("tcgetattr");
+ return -1;
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1)
+ {
+ perror ("tcgetattr");
+ return -1;
+ }
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) {
+ perror("ioctl");
+ return -1;
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1)
+ {
+ perror ("ioctl");
+ return -1;
+ }
+ if (openpty(&p->mfd, &p->sfd, sname, &tt, &win) == -1) {
+#else
@ -58,13 +60,13 @@
if ((p->sfd = open (sname, O_RDWR)) == -1)
{
@@ -628,9 +659,14 @@
@@ -619,9 +652,14 @@
for (i = 3; i < 100; ++i)
close (i);
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);
@ -73,21 +75,21 @@
(void) ioctl (0, TIOCSWINSZ, &winorig);
setuid (getuid ());
@@ -672,6 +708,13 @@
@@ -663,6 +701,13 @@
{
static struct termios termnew;
+#ifdef __FreeBSD__
+ if (tcgetattr(ttyfd, &termorig) == -1)
+ {
+ perror("tcgetattr failed");
+ perror ("tcgetattr failed");
+ exit (EXIT_FAILURE);
+ }
+#else
#ifdef TCGETS
if (ioctl (ttyfd, TCGETS, &termorig) == -1)
{
@@ -679,6 +722,7 @@
@@ -670,6 +715,7 @@
exit (EXIT_FAILURE);
}
#endif
@ -95,19 +97,19 @@
if (ioctl (ttyfd, TIOCGWINSZ, &winorig) == -1)
{
@@ -686,6 +730,11 @@
@@ -677,6 +723,11 @@
exit (EXIT_FAILURE);
}
+#ifdef __FreeBSD__
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+#else
termnew.c_cc[VEOF] = 1;
termnew.c_iflag = BRKINT | ISTRIP | IXON | IXANY;
termnew.c_oflag = 0;
@@ -695,13 +744,19 @@
@@ -686,13 +737,19 @@
#ifdef TCSETS
(void) ioctl (ttyfd, TCSETS, &termnew);
#endif
@ -119,7 +121,7 @@
{
+
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);

View File

@ -1,5 +1,5 @@
--- src/sudosh.c.orig Sun Jun 12 18:13:15 2005
+++ src/sudosh.c Thu Jun 16 21:02:50 2005
--- src/sudosh.c.orig Sun Jun 12 19:35:07 2005
+++ src/sudosh.c Thu Jan 4 08:29:43 2007
@@ -28,6 +28,13 @@
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
@ -14,24 +14,26 @@
static struct termios termorig;
static struct winsize winorig;
@@ -554,19 +561,43 @@
@@ -545,19 +552,45 @@
{
char *sname;
+#ifdef __FreeBSD__
+#define PTYLEN 16
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1) {
+ perror("tcgetattr");
+ return -1;
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1)
+ {
+ perror ("tcgetattr");
+ return -1;
+ }
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) {
+ perror("ioctl");
+ return -1;
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1)
+ {
+ perror ("ioctl");
+ return -1;
+ }
+ if (openpty(&p->mfd, &p->sfd, sname, &tt, &win) == -1) {
+#else
@ -58,13 +60,13 @@
if ((p->sfd = open (sname, O_RDWR)) == -1)
{
@@ -628,9 +659,14 @@
@@ -619,9 +652,14 @@
for (i = 3; i < 100; ++i)
close (i);
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);
@ -73,21 +75,21 @@
(void) ioctl (0, TIOCSWINSZ, &winorig);
setuid (getuid ());
@@ -672,6 +708,13 @@
@@ -663,6 +701,13 @@
{
static struct termios termnew;
+#ifdef __FreeBSD__
+ if (tcgetattr(ttyfd, &termorig) == -1)
+ {
+ perror("tcgetattr failed");
+ perror ("tcgetattr failed");
+ exit (EXIT_FAILURE);
+ }
+#else
#ifdef TCGETS
if (ioctl (ttyfd, TCGETS, &termorig) == -1)
{
@@ -679,6 +722,7 @@
@@ -670,6 +715,7 @@
exit (EXIT_FAILURE);
}
#endif
@ -95,19 +97,19 @@
if (ioctl (ttyfd, TIOCGWINSZ, &winorig) == -1)
{
@@ -686,6 +730,11 @@
@@ -677,6 +723,11 @@
exit (EXIT_FAILURE);
}
+#ifdef __FreeBSD__
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+#else
termnew.c_cc[VEOF] = 1;
termnew.c_iflag = BRKINT | ISTRIP | IXON | IXANY;
termnew.c_oflag = 0;
@@ -695,13 +744,19 @@
@@ -686,13 +737,19 @@
#ifdef TCSETS
(void) ioctl (ttyfd, TCSETS, &termnew);
#endif
@ -119,7 +121,7 @@
{
+
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);

View File

@ -1,5 +1,5 @@
--- src/sudosh.c.orig Sun Jun 12 18:13:15 2005
+++ src/sudosh.c Thu Jun 16 21:02:50 2005
--- src/sudosh.c.orig Sun Jun 12 19:35:07 2005
+++ src/sudosh.c Thu Jan 4 08:29:43 2007
@@ -28,6 +28,13 @@
#define WRITE(a, b, c) do_write(a, b, c, __FILE__, __LINE__)
@ -14,24 +14,26 @@
static struct termios termorig;
static struct winsize winorig;
@@ -554,19 +561,43 @@
@@ -545,19 +552,45 @@
{
char *sname;
+#ifdef __FreeBSD__
+#define PTYLEN 16
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+ char sname_area[PTYLEN];
+ struct termios tt;
+ struct winsize win;
+
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1) {
+ perror("tcgetattr");
+ return -1;
+ sname = sname_area;
+ if (tcgetattr(STDIN_FILENO, &tt) == -1)
+ {
+ perror ("tcgetattr");
+ return -1;
+ }
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) {
+ perror("ioctl");
+ return -1;
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1)
+ {
+ perror ("ioctl");
+ return -1;
+ }
+ if (openpty(&p->mfd, &p->sfd, sname, &tt, &win) == -1) {
+#else
@ -58,13 +60,13 @@
if ((p->sfd = open (sname, O_RDWR)) == -1)
{
@@ -628,9 +659,14 @@
@@ -619,9 +652,14 @@
for (i = 3; i < 100; ++i)
close (i);
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) login_tty(pst->sfd);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);
@ -73,21 +75,21 @@
(void) ioctl (0, TIOCSWINSZ, &winorig);
setuid (getuid ());
@@ -672,6 +708,13 @@
@@ -663,6 +701,13 @@
{
static struct termios termnew;
+#ifdef __FreeBSD__
+ if (tcgetattr(ttyfd, &termorig) == -1)
+ {
+ perror("tcgetattr failed");
+ perror ("tcgetattr failed");
+ exit (EXIT_FAILURE);
+ }
+#else
#ifdef TCGETS
if (ioctl (ttyfd, TCGETS, &termorig) == -1)
{
@@ -679,6 +722,7 @@
@@ -670,6 +715,7 @@
exit (EXIT_FAILURE);
}
#endif
@ -95,19 +97,19 @@
if (ioctl (ttyfd, TIOCGWINSZ, &winorig) == -1)
{
@@ -686,6 +730,11 @@
@@ -677,6 +723,11 @@
exit (EXIT_FAILURE);
}
+#ifdef __FreeBSD__
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+ (void) cfmakeraw(&termnew);
+ termnew.c_lflag &= ~ECHO;
+ (void) tcsetattr(ttyfd, TCSAFLUSH, &termnew);
+#else
termnew.c_cc[VEOF] = 1;
termnew.c_iflag = BRKINT | ISTRIP | IXON | IXANY;
termnew.c_oflag = 0;
@@ -695,13 +744,19 @@
@@ -686,13 +737,19 @@
#ifdef TCSETS
(void) ioctl (ttyfd, TCSETS, &termnew);
#endif
@ -119,7 +121,7 @@
{
+
+#ifdef __FreeBSD__
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+ (void) tcsetattr(0, TCSADRAIN, &termorig);
+#else
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);