Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
To: binutils@sources.redhat.com, gdb@sources.redhat.com
Subject: [PATCH] Small fixes for expect to allow compilation with native IRIX6 tools
Date: Mon, 25 Mar 2002 15:27:00 -0000	[thread overview]
Message-ID: <20020325232658.GB467@rembrandt.csv.ica.uni-stuttgart.de> (raw)

Hello All,

this patch does some code cleanup and adds some missing ifdef's in
places where the native IRIX6 tools are complaining about.


Thiemo


	/expect/ChangeLog
	* exp_clib.c: Fix bad comment nesting. Code cleanup.
	* exp_command.c: Likewise. Ifdef out code of some old TCL support.
	Cast some type conversions explicitly.


diff -BurpN source-orig/expect/exp_clib.c source/expect/exp_clib.c
--- source-orig/expect/exp_clib.c	Sat Sep  8 08:26:30 2001
+++ source/expect/exp_clib.c	Thu Feb 21 07:03:27 2002
@@ -126,7 +126,7 @@ static struct f {
 
 	char *buffer;		/* buffer of matchable chars */
 	char *buffer_end;	/* one beyond end of matchable chars */
-	/*char *match;		/* start of matched string */
+	/*char *match;*/		/* start of matched string */
 	char *match_end;	/* one beyond end of matched string */
 	int msize;		/* size of allocate space */
 				/* actual size is one larger for null */
@@ -191,7 +191,6 @@ char *argv[];	/* some compiler complains
 	int cc;
 	int errorfd;	/* place to stash fileno(stderr) in child */
 			/* while we're setting up new stderr */
-	int ttyfd;
 	int sync_fds[2];
 	int sync2_fds[2];
 	char sync_byte;
@@ -344,10 +343,14 @@ when trapping, see below in child half o
 /*	setpgrp(0,getpid());*/	/* make a new pgrp leader */
 
 #ifdef TIOCNOTTY
-	ttyfd = open("/dev/tty", O_RDWR);
-	if (ttyfd >= 0) {
-		(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
-		(void) close(ttyfd);
+	{
+		int ttyfd;
+
+		ttyfd = open("/dev/tty", O_RDWR);
+		if (ttyfd >= 0) {
+			(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
+			(void) close(ttyfd);
+		}
 	}
 #endif /* TIOCNOTTY */
 
@@ -506,7 +509,7 @@ when trapping, see below in child half o
 	/* wait for master to let us go on */
 	/* debuglog("child: waiting for go ahead from parent\r\n"); */
 
-/*	close(master);	/* force master-side close so we can read */
+/*	close(master);*/	/* force master-side close so we can read */
 	cc = read(sync2_fds[0],&sync_byte,1);
 	if (cc == -1) {
 		restore_error_fd
@@ -773,7 +776,7 @@ struct exp_case *ecases;
 	for (ec=ecases;ec->type != exp_end;ec++) {
 		if ((ec->type == exp_regexp) && !ec->re) {
 			TclRegError((char *)0);
-			if (!(ec->re = TclRegComp(ec->pattern))) {
+			if (!(ec->re = (Expect_regexp *)TclRegComp(ec->pattern))) {
 				fprintf(stderr,"regular expression %s is bad: %s",ec->pattern,TclGetRegError());
 				return_errno(EINVAL);
 			  }
@@ -1156,8 +1159,6 @@ char *program;
 int
 exp_disconnect()
 {
-	int ttyfd;
-
 #ifndef EALREADY
 #define EALREADY 37
 #endif
@@ -1189,11 +1190,15 @@ exp_disconnect()
 	setpgrp(0,getpid());	/* put process in our own pgrp */
 /* Pyramid lacks this defn */
 #ifdef TIOCNOTTY
-	ttyfd = open("/dev/tty", O_RDWR);
-	if (ttyfd >= 0) {
-		/* zap controlling terminal if we had one */
-		(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
-		(void) close(ttyfd);
+	{
+		int ttyfd;
+
+		ttyfd = open("/dev/tty", O_RDWR);
+		if (ttyfd >= 0) {
+			/* zap controlling terminal if we had one */
+			(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
+			(void) close(ttyfd);
+		}
 	}
 #endif /* TIOCNOTTY */
 #endif /* SYSV3 */
diff -BurpN source-orig/expect/exp_command.c source/expect/exp_command.c
--- source-orig/expect/exp_command.c	Tue Sep 11 21:24:03 2001
+++ source/expect/exp_command.c	Thu Feb 21 06:54:55 2002
@@ -215,8 +215,10 @@ int pid;
 }
 #endif
 
+#if 0  /* old Tcl 7.6 code */
 /* Tcl needs commands in writable space */
 static char close_cmd[] = "close";
+#endif
 
 /* zero out the wait status field */
 static void
@@ -627,11 +629,8 @@ char **argv;
 	int slave;
 	int pid;
 	char **a;
-	/* tell Saber to ignore non-use of ttyfd */
-	/*SUPPRESS 591*/
 	int errorfd;	/* place to stash fileno(stderr) in child */
 			/* while we're setting up new stderr */
-	int ttyfd;
 	int master;
 	int write_master;	/* write fd of Tcl-opened files */
 	int ttyinit = TRUE;
@@ -654,8 +653,10 @@ char **argv;
 	char *argv0 = argv[0];
 	char *openarg = 0;
 	int leaveopen = FALSE;
+#if TCL7_4
 	FILE *readfilePtr;
 	FILE *writefilePtr;
+#endif
 	int rc, wc;
 	char *stty_init;
 	int slave_write_ioctls = 1;
@@ -917,7 +918,7 @@ when trapping, see below in child half o
 #endif /* TCL_MAJOR_VERSION < 8 */
 		}
 
-		master = ((mode & TCL_READABLE)?rfd:wfd);
+		master = (int)((mode & TCL_READABLE)?rfd:wfd);
 
 		/* make a new copy of file descriptor */
 		if (-1 == (write_master = master = dup(master))) {
@@ -927,7 +928,7 @@ when trapping, see below in child half o
 
 		/* if writefilePtr is different, dup that too */
 		if ((mode & TCL_READABLE) && (mode & TCL_WRITABLE) && (wfd != rfd)) {
-			if (-1 == (write_master = dup(wfd))) {
+			if (-1 == (write_master = dup((int)wfd))) {
 				exp_error(interp,"fdopen: %s",Tcl_PosixError(interp));
 				return TCL_ERROR;
 			}
@@ -1229,10 +1230,14 @@ parent_error:
 
 /* Pyramid lacks this defn */
 #ifdef TIOCNOTTY
-	ttyfd = open("/dev/tty", O_RDWR);
-	if (ttyfd >= 0) {
-		(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
-		(void) close(ttyfd);
+	{
+		int ttyfd;
+
+		ttyfd = open("/dev/tty", O_RDWR);
+		if (ttyfd >= 0) {
+			(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
+			(void) close(ttyfd);
+		}
 	}
 #endif /* TIOCNOTTY */
 
@@ -1390,7 +1395,7 @@ parent_error:
 	/* wait for master to let us go on */
 	/* debuglog("child: waiting for go ahead from parent\r\n"); */
 
-/*	close(master);	/* force master-side close so we can read */
+/*	close(master);*/	/* force master-side close so we can read */
 
 	while (((rc = read(sync2_fds[0],&sync_byte,1)) < 0) && (errno == EINTR)) {
 		/* empty */;
@@ -2230,7 +2235,9 @@ char **argv;
 	int append = TRUE;
 	char *filename = 0;
 	char *type;
+#if TCL7_4
 	FILE *writefilePtr;
+#endif
 	int usage_error_occurred = FALSE;
 
 	openarg = 0;
@@ -2327,7 +2334,9 @@ char **argv;
 			goto error;
 		}
 	} else if (openarg) {
+#if TCL7_4
 		int cc;
+#endif
 		int fd;
 		Tcl_Channel chan;
 		int mode;
@@ -3125,10 +3134,6 @@ Tcl_Interp *interp;
 int argc;
 char **argv;
 {
-	/* tell Saber to ignore non-use of ttyfd */
-	/*SUPPRESS 591*/
-	int ttyfd;
-
 	if (argc > 1) {
 		exp_error(interp,"usage: disconnect");
 		return(TCL_ERROR);
@@ -3197,11 +3202,15 @@ char **argv;
 
 /* Pyramid lacks this defn */
 #ifdef TIOCNOTTY
-	ttyfd = open("/dev/tty", O_RDWR);
-	if (ttyfd >= 0) {
-		/* zap controlling terminal if we had one */
-		(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
-		(void) close(ttyfd);
+	{
+		int ttyfd;
+
+		ttyfd = open("/dev/tty", O_RDWR);
+		if (ttyfd >= 0) {
+			/* zap controlling terminal if we had one */
+			(void) ioctl(ttyfd, TIOCNOTTY, (char *)0);
+			(void) close(ttyfd);
+		}
 	}
 #endif /* TIOCNOTTY */
 


             reply	other threads:[~2002-03-25 23:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-25 15:27 Thiemo Seufer [this message]
2002-03-25 17:19 ` DJ Delorie
2002-03-25 19:51   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020325232658.GB467@rembrandt.csv.ica.uni-stuttgart.de \
    --to=ica2_ts@csv.ica.uni-stuttgart.de \
    --cc=binutils@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox