*** /p/kd/fdc/mm/work/ccmd/ccmdmd.c	2006-01-09 12:35:27.340848000 -0500
--- ./ccmdmd.c	2005-08-26 10:44:46.000000000 -0400
***************
*** 763,769 ****
  
  /* auxiliary routines to take terminals into and out of raw mode */
  
- static int tty_saved = 0;
  #if defined(needTERMIOS)		/* POSIX.1 */
     static struct termios ttyblk, ttysav;
  #else
--- 763,768 ----
***************
*** 792,799 ****
  #if defined(needTERMIOS)		/* POSIX.1 */
    if (tcgetattr(fd, &ttysav) < 0)
  	fprintf(stderr,"Cannot set tty attributes: error %d\n", errno);
-   else
-     tty_saved++;
    ttyblk = ttysav;
    ttyblk.c_lflag &= ~(ICANON|ECHO);
    ttyblk.c_cc[VINTR] = 003;		/* interrupt char is control-c */
--- 791,796 ----
***************
*** 804,810 ****
  #else
  #  if defined(needTERMIO)
    ioctl(fd, TCGETA, &ttysav);
-   tty_saved++;
    ttyblk = ttysav;
    ttyblk.c_lflag &= ~(ICANON|ECHO);
    ttyblk.c_cc[0] = 003;			/* interrupt char is control-c */
--- 801,806 ----
***************
*** 813,819 ****
    ioctl(fd,TCSETAW,&ttyblk);		/* set new modes . */
  #  else 				/* must be BSD sgtty style */
    ioctl(fd,TIOCGETP,&ttysav);		/* get original parameters */
-   tty_saved++;
    ttyblk = ttysav;			/* copy into new parameter block */
    ospeed = ttysav.sg_ospeed;		/* save output speed for termlib */
    ttyblk.sg_flags &= ~(RAW | ECHO | LCASE); /* no echoing or xlates */
--- 809,814 ----
***************
*** 837,857 ****
  int fd;
  #endif /* HAVE_STDC */
  {
-     if (!tty_saved)
-       return;
- 
  #if defined(needTERMIOS)
- #ifdef F_GETFD
-     /* It appears that sometimes this routine is called when fd not open */
-     /* Catch this before doing tcsetattr() to avoid the error message */
-     if (fcntl(fd,F_GETFD) == -1) {
- 	/* perror("unraw"); */		/* "bad file number" */
- 	return;
-     }
- #endif	/* F_GETFD */
      if (tcsetattr(fd, TCSANOW, &ttysav) < 0)
!       /* fprintf(stderr,"Cannot restore tty attributes: error %d\n", errno); */
!       perror("Cannot restore tty attributes");
  #else
  #  if defined(needTERMIO)
      ioctl(fd,TCSETAW, &ttysav);		/* put back saved params */
--- 832,840 ----
  int fd;
  #endif /* HAVE_STDC */
  {
  #if defined(needTERMIOS)
    if (tcsetattr(fd, TCSANOW, &ttysav) < 0)
! 	fprintf(stderr,"Cannot restore tty attributes: error %d\n", errno);
  #else
  #  if defined(needTERMIO)
    ioctl(fd,TCSETAW, &ttysav);		/* put back saved params */
*** /p/kd/fdc/mm/work/ccmd/setenv.c	2006-01-10 12:17:53.000000000 -0500
--- ./setenv.c	2005-05-28 14:52:37.000000000 -0400
***************
*** 47,56 ****
  extern char **environ;
  
  int setenv ARGS((const char *name, const char *value, int rewrite));
- 
- #ifndef __NetBSD__
  void unsetenv ARGS((const char *name));
! #endif /* __NetBSD__ */
  /*
   * setenv --
   *	Set the value of the environmental variable "name" to be
--- 47,54 ----
  extern char **environ;
  
  int setenv ARGS((const char *name, const char *value, int rewrite));
  void unsetenv ARGS((const char *name));
! 
  /*
   * setenv --
   *	Set the value of the environmental variable "name" to be
***************
*** 114,120 ****
  	return(0);
  }
  
- #ifndef __NetBSD__
  /*
   * unsetenv(name) --
   *	Delete environmental variable "name".
--- 112,117 ----
***************
*** 135,140 ****
  			if (!(*P = *(P + 1)))
  				break;
  }
- #endif /* __NetBSD__ */
  
  #endif /* !defined(HAVE_GNU_LINUX) */
--- 132,136 ----
