[4423] in Athena Bugs

home help back first fref pref prev next nref lref last post

assorted patches for tcsh

daemon@ATHENA.MIT.EDU (John Carr)
Tue Mar 6 06:26:15 1990

To: bugs@ATHENA.MIT.EDU
Date: Tue, 06 Mar 90 06:25:52 EST
From: John Carr <jfc@ATHENA.MIT.EDU>

The patches in this message fix the following problems with tcsh (most of
these are portability issues; the second and last are relevant to the RT):

	Uses own declarations of str*() instead of the ones in <strings.h>
	[this breaks on systems where these functions are really macros, for
	example the NeXT]

	A variable declared as an unsigned type is assigned the return value
	of the open() system call, making error detection impossible.
	[Problem on systems with unsigned char by default]

	Signal handler function return type assumed to be int.  [Problem
	on NeXT]

	Assumes a specific set of tty control characters defined.  [CERASE
	and CKILL are not defined on at least one of PS/2 AIX and NeXT mach]

	Assumes that the path name "" is equivalent to ".".  [Not true in
	AIX]

	Misuse of preprocessor directives upsets some compilers, and does
	the wrong thing with certain definitions of OTHERSH and MACHCHK.

	Assumes there are 32 signals.  [AIX has 64; the array of signal
	names must be changed for AIX as well]

	Uses C function to do block moves on anything but a vax; hc on the
	RT has a built in function that does this much faster.



*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.misc.c	Wed Nov 18 00:25:14 1987
--- sh.misc.c	Sun Feb 25 10:21:30 1990
***************
*** 349,354 ****
--- 349,355 ----
  	return (blkcpy(nv, v));
  }
  
+ #ifndef strend
  char *
  strend(cp)
  	register char *cp;
***************
*** 358,363 ****
--- 359,365 ----
  		cp++;
  	return (cp);
  }
+ #endif
  
  char *
  strip(cp)

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.resize.c	Wed Nov 18 00:34:03 1987
--- sh.resize.c	Fri Feb 23 17:57:42 1990
***************
*** 17,23 ****
  #include <sys/ioctl.h>
  #include "sh.h"
  
! char *strindex (), *index (), *getenv();
  
  int /* boolean */ winsize_changed = 0;
  
--- 17,25 ----
  #include <sys/ioctl.h>
  #include "sh.h"
  
! char  *getenv();
! static char *strindex();
! static int IntToAscii();
  
  int /* boolean */ winsize_changed = 0;
  
*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.c	Sat Jul 30 19:57:00 1988
--- sh.c	Tue Mar  6 06:03:22 1990
***************
*** 36,42 ****
  char	hostname[80];
  char	HIST = '!';
  char	HISTSUB = '^';
! bool	nofile;
  bool	reenter;
  bool	nverbose;
  bool	nexececho;
--- 36,42 ----
  char	hostname[80];
  char	HIST = '!';
  char	HISTSUB = '^';
! int	nofile;
  bool	reenter;
  bool	nverbose;
  bool	nexececho;
***************
*** 54,63 ****
  bool	precmd_active;
  bool	periodic_active;
  bool	source_active = 0;	/* In the middle of doing a source... */
- int	phup();
  
  #ifdef AUTOLOGOUT
! #   define DEFAULT_AUTOLOGOUT	   "60"	   /* 1 Hour Alarm default */
      
  auto_logout ()
  {
--- 54,62 ----
  bool	precmd_active;
  bool	periodic_active;
  bool	source_active = 0;	/* In the middle of doing a source... */
  
  #ifdef AUTOLOGOUT
! #   define DEFAULT_AUTOLOGOUT	   "90"	   /* 1 1/2 Hour Alarm default */
      
  auto_logout ()
  {
***************
*** 579,585 ****
  	bool otell = cantell;
  #endif
  	struct Bin saveB;
- 
  	/* The (few) real local variables */
  	jmp_buf oldexit;
  	int reenter, omask;
--- 578,583 ----
***************
*** 747,752 ****
--- 745,753 ----
  /*
   * in the event of a HUP we want to save the history
   */
+ #ifdef VOID_SIG_HANDLER
+ void
+ #endif
  phup()
  {
  	rechist();
***************
*** 1123,1130 ****
--- 1124,1135 ----
  	(void) ioctl(f, TIOCGLTC, (char *) &ltbuf);
  	buf.sg_flags &= ~(RAW|CBREAK|VTDELAY|ALLDELAY);
  	buf.sg_flags |= XTABS|ECHO|CRMOD|ANYP;
+ #ifdef CERASE
  	reset_tty(&buf.sg_erase, CERASE);
+ #endif
+ #ifdef CKILL
  	reset_tty(&buf.sg_kill, CKILL);
+ #endif
  	reset_tty(&tbuf.t_intrc, CINTR);
  	reset_tty(&tbuf.t_quitc, CQUIT);
  	reset_tty(&tbuf.t_startc, CSTART);

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.glob.c	Thu Nov 19 22:16:40 1987
--- sh.glob.c	Tue Feb 27 22:20:49 1990
***************
*** 208,214 ****
  	register struct direct *dp;
  	register DIR *dirp;
  
! 	dirp = opendir(gpath);
  	if (dirp == NULL) {
  		if (globbed)
  			return;
--- 208,214 ----
  	register struct direct *dp;
  	register DIR *dirp;
  
! 	dirp = opendir(*gpath ? gpath : ".");
  	if (dirp == NULL) {
  		if (globbed)
  			return;

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.exec.c	Tue Feb 20 19:12:43 1990
--- sh.exec.c	Tue Mar  6 06:00:36 1990
***************
*** 249,255 ****
  		 */
  		v = adrof1("shell", &aliases);
  		if (v == 0) {
! #ifdef OTHERSH && !MACHCHK
  			register int ff = open(f, 0);
  			char ch;
  #endif
--- 249,255 ----
  		 */
  		v = adrof1("shell", &aliases);
  		if (v == 0) {
! #if defined(OTHERSH) && !defined(MACHCHK)
  			register int ff = open(f, 0);
  			char ch;
  #endif
***************
*** 264,271 ****
--- 264,273 ----
  			if (ff != -1 && read(ff, &ch, 1) == 1 && ch != '#')
  #endif
  				vp[0] = OTHERSH;
+ #ifndef MACHCHK
  			(void) close(ff);
  #endif
+ #endif
  		} else
  			vp = v->vec;
  		t[0] = f;

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.proc.c	Sat Nov 21 14:46:39 1987
--- sh.proc.c	Sun Feb 25 09:51:55 1990
***************
*** 830,836 ****
  			for (signum = 1; signum <= NSIG; signum++) {
  				if (name = mesg[signum].iname)
  					printf("%s ", name);
! 				if (signum == 16)
  					putchar('\n');
  			}
  			putchar('\n');
--- 830,836 ----
  			for (signum = 1; signum <= NSIG; signum++) {
  				if (name = mesg[signum].iname)
  					printf("%s ", name);
! 				if ((signum % 16) == 0)
  					putchar('\n');
  			}
  			putchar('\n');

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.init.c	Sat Jul 30 19:59:49 1988
--- sh.init.c	Sun Feb 25 09:53:38 1990
***************
*** 294,304 ****
--- 294,348 ----
  	"IO",	"I/O possible on descriptor",
  	"XCPU",	"Cputime limit exceeded",
  	"XFSZ", "Filesize limit exceeded",
+ #ifdef AIX
+ 	"SIG 26","Signal 26",
+ 	"MSG",	"HFT input data pending",
+ #else
  	"VTALRM","Virtual timer expired",
  	"PROF",	"Profiling timer expired",
+ #endif
  	"WINCH","Window size changed",
+ #ifdef AIX
+ 	"PWR",	"Power failure imminent",
+ #else
  	0,	"Signal 29",
+ #endif
  	"USR1",	"User defined signal 1",
  	"USR2",	"User defined signal 2",
+ #ifdef AIX
+ 	"PROF",	"Profiling timer expired",
+ 	"DANGER","System crash imminent",
+ 	"VTALRM","Virtual timer expired",
+ 	"MIGRATE","Migrate process",
+ 	"PRE",	"Programming exception",
+ 	0,	"Signal 37",
+ 	0,	"Signal 38",
+ 	0,	"Signal 39",
+ 	0,	"Signal 40",
+ 	0,	"Signal 41",
+ 	0,	"Signal 42",
+ 	0,	"Signal 43",
+ 	0,	"Signal 44",
+ 	0,	"Signal 45",
+ 	0,	"Signal 46",
+ 	0,	"Signal 47",
+ 	0,	"Signal 48",
+ 	0,	"Signal 49",
+ 	0,	"Signal 50",
+ 	0,	"Signal 51",
+ 	0,	"Signal 52",
+ 	0,	"Signal 53",
+ 	0,	"Signal 54",
+ 	0,	"Signal 55",
+ 	0,	"Signal 56",
+ 	0,	"Signal 57",
+ 	0,	"Signal 58",
+ 	0,	"Signal 59",
+ 	"GRANT","HFT monitor mode granted",
+ 	"RETRACT","HFT monitor mode retracted",
+ 	"SOUND","HFT sound sequence complete",
+ 	0,	"Signal 63",
+ #else	
  	0,	"Signal 32"
+ #endif
  };

*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.h	Sat Nov 21 11:59:43 1987
--- sh.h	Sun Feb 25 10:21:45 1990
***************
*** 14,19 ****
--- 14,20 ----
  #include <sys/signal.h>
  #include <errno.h>
  #include <setjmp.h>
+ #include <strings.h>
  #include "sh.local.h"
  #include "sh.char.h"
  
***************
*** 166,173 ****
--- 167,179 ----
  #define	resexit(a)	copy((char *)reslab, ((char *)(a)), sizeof reslab)
  
  char	*gointr;		/* Label for an onintr transfer */
+ #ifdef VOID_SIG_HANDLER
+ void	(*parintr)();		/* Parents interrupt catch */
+ void	(*parterm)();		/* Parents terminate catch */
+ #else
  int	(*parintr)();		/* Parents interrupt catch */
  int	(*parterm)();		/* Parents terminate catch */
+ #endif
  
  /*
   * Lexical definitions.
***************
*** 460,479 ****
  char	**glob();
  struct tm	*localtime();
  char	*globone();
- char	*index();
  struct	biltins *isbfunc();
  off_t	lseek();
  char	*operate();
  int	phup();
  int	pintr();
  int	pchild();
  char	*putn();
- char	*rindex();
  char	**saveblk();
  char	*savestr();
- char	*strcat();
- char	*strcpy();
- char	*strend();
  char	*strings();
  char	*strip();
  char	*strspl();
--- 466,484 ----
  char	**glob();
  struct tm	*localtime();
  char	*globone();
  struct	biltins *isbfunc();
  off_t	lseek();
  char	*operate();
+ #ifdef VOID_SIG_HANDLER
+ void	phup();
+ #else
  int	phup();
+ #endif
  int	pintr();
  int	pchild();
  char	*putn();
  char	**saveblk();
  char	*savestr();
  char	*strings();
  char	*strip();
  char	*strspl();
***************
*** 489,494 ****
--- 494,501 ----
  char	*xhome();
  char	*xname();
  char	*xset();
+ 
+ #define strend(str) (str + strlen(str))
  
  #define	NOSTR	((char *) 0)
  
*** /afs/rel-eng/project/release/future/source/athena/bin/tcsh/sh.local.h	Sat Jul 30 20:17:18 1988
--- sh.local.h	Tue Mar  6 01:44:17 1990
***************
*** 32,37 ****
--- 32,43 ----
  #ifdef ibm032
  #define HOSTTYPE "rt"
  #endif
+ #ifdef NeXT
+ #define HOSTTYPE "NeXT"
+ #endif
+ #if defined(i386) && defined(AIX)
+ #define	HOSTTYPE "ps2"
+ #endif
  
  /*
   * Fundamental definitions which may vary from system to system.
***************
*** 71,77 ****
--- 73,91 ----
  #ifdef vax
  #define	copy(to, from, size)	bcopy(from, to, size)
  #endif
+ #ifdef __HIGHC__
+ #define copy(to, from, size)	memcpy(from, to, size)
+ #endif
  
  #ifdef PROF
  #define	exit(n)	done(n)
+ #endif
+ 
+ #ifdef NeXT
+ #define VOID_SIG_HANDLER
+ #endif
+ 
+ #if defined(AIX)
+ #define setpgrp(x, y) setpgid(x, y)
+ typedef int bool_t;
  #endif

home help back first fref pref prev next nref lref last post