From: hedrick@klinzhai.rutgers.edu (Charles Hedrick)
Subject: changes for shell utils for SVr4
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 22 Dec 1992 20:27:52 GMT

The following changes to shellutils.1.18 are for System V release 4 at
Rutgers.  Note that I've simply edited the files, rather than putting
the right support in configure, so you'll no doubt want to reorganize
them somewhere.

These programs are affected by the following Rutgers programming
conventions:

  - all programs that initialize the environment for a user
	must read /etc/default/login.  This is a feature of svr4 that 
	I really like.  However I think the ATT code only uses it
	in login.  We do it in rlogind, etc., also.  Note that EDITOR
	and MANPATH are Rutgers extensions.

  - all programs that take passwords must understand Kerberos
	v5.  (Actually this patch isn't complete, because I
	don't have the SecureID code in yet.) The specific convention
	of putting ##principalname in the password field for
	kerberized users is Rutgers-specific.

  - all programs must support usernames of at least 32 characters
	(the maximum size defined by SVr4)

su:
  - for svr4, make it get initial environment variable values from
	/etc/default/login.  
  - use kerberos for password checking where appropriate.

who:
  - make it read utmpx instead of utmp.  In svr4, utmp has a truncated
	user name (8 characters only) and no hostname.  You need
	utmpx to get the full 32-char user name and the hostname.
	Note that we have to hardcode the field widths.  With the
	new extended types, the widths are enough that we really
	have to truncate them in order to get a reasonable output
	format.
  - add the -a option, which is designed for looking at wtmpx, though
	it can also be used for debugging of code that manipulates utmpx.
	Wtmpx can get arbitrarily big, so don't read the whole file
	into memory with -a.

stty 
  - add support for various bits and characters present in SVr4.  While
	this does work, I ended up deciding to use Sun's stty.  There
	are too many additional features, including some bizarre
	fields used to control international character sets, and
	features controlling X.25 lines.  It would take a bit of work
	to reverse engineer all of that.  I don't really see the point,
	since Sun's stty works fine.

configure:
  - claimed that TIOCGWINSZ is broken.  It's not.  The test program
	forgot to include <sys/stream.h>.


*** Makefile.ORIG	Tue Dec 22 15:07:38 1992
--- Makefile	Mon Dec 21 22:04:42 1992
***************
*** 31,36 ****
--- 31,40 ----
  PROGS = basename date dirname echo env expr false groups id logname \
  pathchk printenv printf sleep tee test true tty who whoami yes  uname nice nohup stty
  
+ KRB=../../kerberos5
+ KRBL= ${KRB}/lib/libkrb5.a ${KRB}/lib/libadm5.a ${KRB}/lib/libkrb5.a ${KRB}/lib/libdes5.a ${KRB}/isode-interim/libisode.a ${KRB}/com_err/libcom_err.a      
+ 
+ 
  all: $(PROGS) su
  
  .c.o:
***************
*** 131,138 ****
  	$(CC) $(LDFLAGS) -o $@ sleep.o ../lib/libshu.a version.o $(LIBS)
  
  su: su.o
! 	$(CC) $(LDFLAGS) -o $@ su.o ../lib/libshu.a version.o $(LIBS)
  
  tee: tee.o
  	$(CC) $(LDFLAGS) -o $@ tee.o ../lib/libshu.a version.o $(LIBS)
  
--- 135,144 ----
  	$(CC) $(LDFLAGS) -o $@ sleep.o ../lib/libshu.a version.o $(LIBS)
  
  su: su.o
! 	$(CC) $(LDFLAGS) -o $@ su.o ../lib/libshu.a version.o $(LIBS) \
! ${KRB}/pwdauthd/pwdkrb.o ${KRB}/pwdauthd/kdebug.o ${KRBL} -lnsl -lresolv -lsocket -lc -Xlinker -R/usr/ucblib -L/usr/ucblib -lucb -lelf
  
+ 
  tee: tee.o
  	$(CC) $(LDFLAGS) -o $@ tee.o ../lib/libshu.a version.o $(LIBS)
  
***************
*** 167,173 ****
  # Special rules for some .o files.
  
  su.o: su.c
! 	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DSYSLOG_FAILURE -DSYSLOG_SUCCESS -I$(srcdir)/../lib $(srcdir)/su.c
  
  test.o: test.c
  	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DTEST_STANDALONE -I$(srcdir)/../lib $(srcdir)/test.c
--- 173,179 ----
  # Special rules for some .o files.
  
  su.o: su.c
! 	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DRUTGERS -DSYSLOG_FAILURE -DSYSLOG_SUCCESS -I$(srcdir)/../lib $(srcdir)/su.c
  
  test.o: test.c
  	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DTEST_STANDALONE -I$(srcdir)/../lib $(srcdir)/test.c
*** su.c.ORIG	Wed Oct 28 14:58:42 1992
--- su.c	Mon Dec 21 22:41:16 1992
***************
*** 115,126 ****
  #include <shadow.h>
  #endif
  
  /* The default PATH for simulated logins to non-superuser accounts.  */
  #define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
- 
  /* The default PATH for simulated logins to superuser accounts.  */
  #define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
  
  /* The shell to run if none is given in the user's passwd entry.  */
  #define DEFAULT_SHELL "/bin/sh"
  
--- 115,138 ----
  #include <shadow.h>
  #endif
  
+ #ifdef RUTGERS
+ #include <wait.h>
+ #endif
+ 
+ #ifdef __svr4__
+ 
+ #define DEFAULT_LOGIN_PATH "/usr/bin"
+ #define DEFAULT_ROOT_LOGIN_PATH "/usr/bin"
+ 
+ #else
+ 
  /* The default PATH for simulated logins to non-superuser accounts.  */
  #define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
  /* The default PATH for simulated logins to superuser accounts.  */
  #define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
  
+ #endif
+ 
  /* The shell to run if none is given in the user's passwd entry.  */
  #define DEFAULT_SHELL "/bin/sh"
  
***************
*** 277,282 ****
--- 289,295 ----
       struct passwd *pw;
  {
    char *unencrypted, *encrypted, *correct;
+   int rval;
  #ifdef HAVE_SHADOW_H
    /* Shadow passwd stuff for SVR3 and maybe other systems.  */
    struct spwd *sp = getspnam (pw->pw_name);
***************
*** 292,300 ****
      return 1;
  
    unencrypted = getpass ("Password:");
!   encrypted = crypt (unencrypted, correct);
!   bzero (unencrypted, strlen (unencrypted));
!   return strcmp (encrypted, correct) == 0;
  }
  
  /* Update `environ' for the new shell based on PW, with SHELL being
--- 305,351 ----
      return 1;
  
    unencrypted = getpass ("Password:");
! #ifdef RUTGERS
!   if (correct[0] == '#' && 
!       correct[1] == '#') {
!     int pid;
!     int status;
!     char prin_name[512], *encpw;
! 
!     encpw = correct+2;
!     if (*encpw >= 'A' && *encpw <= 'Z') {
!       strcpy(prin_name,"+");
!       strcat(prin_name,encpw);
!       strcat(prin_name,"+");
!     } else
!       strcpy(prin_name,encpw);
! 
!     pid = fork ();
!     if (pid == -1) {
!       bzero (unencrypted, strlen (unencrypted));
!       printf("Fork failed.\n");
!       rval = 0;
!     } else if (pid == 0) {
!       setuid(0);  /* without this, the replay cache code won't work */
!       rval = pwdkrb(prin_name, unencrypted, pw->pw_uid);
!       if (rval) {
! 	printf("%s\n", error_message(rval)); /* com_err*/
! 	exit(1);
!       } else
! 	exit(0);
!     } else {
!       bzero (unencrypted, strlen (unencrypted));
!       waitpid (pid, &status, 0);
!       rval = WEXITSTATUS(status) == 0;
!     }
!   } else
! #endif
!     {
!       encrypted = crypt (unencrypted, correct);    
!       bzero (unencrypted, strlen (unencrypted));
!       rval = strcmp (encrypted, correct) == 0;
!     }
!   return rval;
  }
  
  /* Update `environ' for the new shell based on PW, with SHELL being
***************
*** 309,314 ****
--- 360,406 ----
  
    if (simulate_login)
      {
+ #ifdef __svr4__
+       char *tz, *hz, *path, *supath, *umaskstr, *editor, *manpath;
+       int umaskval;
+       char defbuf[256];
+       FILE *deffile;
+ 
+       deffile = fopen("/etc/default/login", "r");
+       if (deffile) {
+ 	while (fgets(defbuf, sizeof(defbuf), deffile) == defbuf) {
+ 	  char *lf = strchr(defbuf, '\n');
+ 	  if (lf)
+ 	    *lf = 0;
+ 
+ 	  if (strncmp(defbuf, "TIMEZONE=", sizeof("TIMEZONE=")-1) == 0)
+ 	    tz = strdup(defbuf + sizeof("TIMEZONE=")-1);
+ 	  else if (strncmp(defbuf, "HZ=", sizeof("HZ=")-1) == 0)
+ 	    hz = strdup(defbuf + sizeof("HZ=")-1);
+ 	  else if (strncmp(defbuf, "PATH=", sizeof("PATH=")-1) == 0)
+ 	    path = strdup(defbuf + sizeof("PATH=")-1);
+ 	  else if (strncmp(defbuf, "SUPATH=", sizeof("SUPATH=")-1) == 0)
+ 	    supath = strdup(defbuf + sizeof("SUPATH=")-1);
+ 	  else if (strncmp(defbuf, "UMASK=", sizeof("UMASK=")-1) == 0)
+ 	    umaskstr = strdup(defbuf + sizeof("UMASK=")-1);
+ 	  else if (strncmp(defbuf, "EDITOR=", sizeof("EDITOR=")-1) == 0)
+ 	    editor = strdup(defbuf + sizeof("EDITOR=")-1);
+ 	  else if (strncmp(defbuf, "MANPATH=", sizeof("MANPATH=")-1) == 0)
+ 	    manpath = strdup(defbuf + sizeof("MANPATH=")-1);
+ 	}
+       }
+ 
+       if (! tz)
+ 	tz = getenv("TZ");
+       if (! hz)
+ 	hz = "100";
+       if (! path)
+ 	path = DEFAULT_LOGIN_PATH;
+       if (! supath)
+ 	supath = DEFAULT_ROOT_LOGIN_PATH;
+       if (umaskstr && sscanf(umaskstr, "%o", &umaskval) == 1 && umaskval)
+ 	umask(umaskval);
+ #endif
        /* Leave TERM unchanged.  Set HOME, SHELL, USER, LOGNAME, PATH.
           Unset all other environment variables.  */
        term = getenv ("TERM");
***************
*** 320,327 ****
--- 412,430 ----
        xputenv (concat ("SHELL", "=", shell));
        xputenv (concat ("USER", "=", pw->pw_name));
        xputenv (concat ("LOGNAME", "=", pw->pw_name));
+ #ifdef __svr4__
+       if (tz)
+ 	xputenv (concat ("TZ", "=", tz));
+       xputenv (concat ("HZ", "=", hz));
+       if (editor)
+ 	xputenv (concat ("EDITOR", "=", editor));
+       if (manpath)
+ 	xputenv (concat ("MANPATH", "=", manpath));
+       xputenv (concat ("PATH", "=", pw->pw_uid ? path : supath));
+ #else
        xputenv (concat ("PATH", "=", pw->pw_uid
  		       ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH));
+ #endif
      }
    else
      {
*** who.c.ORIG	Wed Oct 28 15:02:50 1992
--- who.c	Tue Dec 22 01:32:07 1992
***************
*** 24,29 ****
--- 24,30 ----
     idle: -u
  
     Options:
+    -a		All entries, extended format
     -m		Same as 'who am i', for POSIX.
     -q		Only user names and # logged on; overrides all other options.
     -s		Name, line, time (default).
***************
*** 34,40 ****
--- 35,58 ----
  
  #include <stdio.h>
  #include <sys/types.h>
+ #ifdef __svr4__
+ #include <utmpx.h>
+ #define utmp utmpx
+ #define ut_time ut_tv.tv_sec
+ #undef UTMP_FILE
+ #define UTMP_FILE "/var/adm/utmpx"
+ #define HAVE_UT_HOST
+ #define UTNAMEWID 16
+ #define UTLINEWID 12
+ #define UTHOSTWID 30
+ 
+ #else
  #include <utmp.h>
+ #define UTNAMEWID  (sizeof (this->ut_name))
+ #define UTLINEWID  (sizeof (this->ut_line))
+ #define UTHOSTWID  (sizeof (this->ut_host))
+ #endif
+ 
  #include <time.h>
  #include <getopt.h>
  #ifndef _POSIX_SOURCE
***************
*** 50,55 ****
--- 68,78 ----
  #endif				/* !_PATH_UTMP */
  #endif				/* !UTMP_FILE */
  
+ #ifdef __svr4__
+ /* for MAXHOSTNAMELEN */
+ #include "netdb.h"
+ #endif
+ 
  #ifndef MAXHOSTNAMELEN
  #define MAXHOSTNAMELEN 64
  #endif
***************
*** 78,83 ****
--- 101,109 ----
     Ignored for `who am i'. */
  int short_list;
  
+ /* If nonzero, show all file entries, in extended format */
+ int include_all;
+ 
  /* If nonzero, display the hours:minutes since each user has touched
     the keyboard, or "." if within the last minute, or "old" if
     not within the last day. */
***************
*** 92,97 ****
--- 118,124 ----
  
  struct option longopts[] =
  {
+   {"all", 0, NULL, 'a'},
    {"count", 0, NULL, 'q'},
    {"idle", 0, NULL, 'u'},
    {"heading", 0, NULL, 'H'},
***************
*** 111,121 ****
  
    program_name = argv[0];
  
!   while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind))
  	 != EOF)
      {
        switch (optc)
  	{
  	case 'm':
  	  my_line_only = 1;
  	  break;
--- 138,152 ----
  
    program_name = argv[0];
  
!   while ((optc = getopt_long (argc, argv, "aimqsuwHT", longopts, &longind))
  	 != EOF)
      {
        switch (optc)
  	{
+ 	case 'a':
+ 	  include_all = 1;
+ 	  break;
+ 
  	case 'm':
  	  my_line_only = 1;
  	  break;
***************
*** 186,196 ****
  {
    int users;
  
!   users = read_utmp (filename);
!   if (short_list)
!     list_entries (users);
!   else
!     scan_entries (users);
  }
  
  /* Read the utmp file FILENAME into UTMP_CONTENTS and return the
--- 217,231 ----
  {
    int users;
  
!   if (include_all)
!     list_file (filename);
!   else {
!     users = read_utmp (filename);
!     if (short_list)
!       list_entries (users);
!     else
!       scan_entries (users);
!   }
  }
  
  /* Read the utmp file FILENAME into UTMP_CONTENTS and return the
***************
*** 226,233 ****
--- 261,296 ----
    return file_stats.st_size / sizeof (struct utmp);
  }
  
+ /*
+  * list_file is used for -a.  This is commonly used for dumping
+  * wtmp.  That can grow arbitrarily large, so we don't really
+  * want to read it into memory first.
+  */
+ 
+ list_file (filename)
+      char *filename;
+ {
+   FILE *fp;
+   struct utmp utmp;
+ 
+   fp = fopen (filename, "r");
+   if (! fp)
+     error (1, errno, "%s", filename);
+ 
+   while (fread (&utmp, sizeof(utmp), 1, fp) == 1)
+     print_entry(&utmp);
+ 
+   fclose(fp);
+ }
+ 
+ 
  /* Display a line of information about entry THIS. */
  
+ #ifdef __svr4__
+ char *uttypes[] = {"EMPTY ", "RUNLVL", "BOOT  ", "OLDTIM", "NEWTIM",
+ 		 "INIT  ", "LOGIN ", "USER  ", "DEAD  ", "ACCTNG"};
+ #endif
+ 
  void
  print_entry (this)
       struct utmp *this;
***************
*** 251,262 ****
      }
    
    printf ("%-*.*s",
! 	  sizeof (this->ut_name), sizeof (this->ut_name),
  	  this->ut_name);
    if (include_mesg)
      printf ("  %c  ", mesg);
    printf (" %-*.*s",
! 	  sizeof (this->ut_line), sizeof (this->ut_line),
  	  this->ut_line);
    printf (" %-12.12s", ctime (&this->ut_time) + 4);
    if (include_idle)
--- 314,325 ----
      }
    
    printf ("%-*.*s",
! 	  UTNAMEWID, UTNAMEWID,
  	  this->ut_name);
    if (include_mesg)
      printf ("  %c  ", mesg);
    printf (" %-*.*s",
! 	  UTLINEWID, UTLINEWID,
  	  this->ut_line);
    printf (" %-12.12s", ctime (&this->ut_time) + 4);
    if (include_idle)
***************
*** 266,276 ****
        else
  	printf ("   .  ");
      }
  #ifdef HAVE_UT_HOST
    if (this->ut_host[0])
!     printf (" (%-.*s)", sizeof (this->ut_host), this->ut_host);
  #endif
- 
    putchar ('\n');
  }
  
--- 329,354 ----
        else
  	printf ("   .  ");
      }
+ #ifdef __svr4__
+   if (include_all) {
+     if ((this->ut_type) >= 0 && (this->ut_type) <= UTMAXTYPE)
+       printf(" %s", uttypes[this->ut_type]);
+     else
+       printf(" type=%d", this->ut_type);
+     if (this->ut_id[0])
+       printf(" id=%4.4s", this->ut_id);
+     if (this->ut_pid)
+       printf(" pid=%d", this->ut_pid);
+     if (this->ut_exit.e_termination)
+       printf(" term=%d", this->ut_exit.e_termination);
+     if (this->ut_exit.e_exit)
+       printf(" exit=%d", this->ut_exit.e_exit);
+   }
+ #endif
  #ifdef HAVE_UT_HOST
    if (this->ut_host[0])
!     printf (" (%-.*s)", UTHOSTWID, this->ut_host);
  #endif
    putchar ('\n');
  }
  
***************
*** 305,314 ****
  {
    struct utmp *ut;
  
!   printf ("%-*s ", sizeof (ut->ut_name), "USER");
    if (include_mesg)
      printf ("MESG ");
!   printf ("%-*s ", sizeof (ut->ut_line), "LINE");
    printf ("LOGIN-TIME   ");
    if (include_idle)
      printf ("IDLE  ");
--- 383,392 ----
  {
    struct utmp *ut;
  
!   printf ("%-*s ", UTNAMEWID, "USER");
    if (include_mesg)
      printf ("MESG ");
!   printf ("%-*s ", UTLINEWID, "LINE");
    printf ("LOGIN-TIME   ");
    if (include_idle)
      printf ("IDLE  ");
***************
*** 328,338 ****
  
    while (n--)
      {
!       if (this->ut_name[0]
  #ifdef USER_PROCESS
  	  && this->ut_type == USER_PROCESS
  #endif
! 	 )
  	print_entry (this);
        this++;
      }
--- 406,416 ----
  
    while (n--)
      {
!       if (include_all || (this->ut_name[0]
  #ifdef USER_PROCESS
  	  && this->ut_type == USER_PROCESS
  #endif
! 	 ))
  	print_entry (this);
        this++;
      }
***************
*** 427,434 ****
  usage ()
  {
    fprintf (stderr, "\
! Usage: %s [-imqsuwHT] [--count] [--idle] [--heading] [--message] [--mesg]\n\
!        [--writable] [file] [am i]\n",
  	   program_name);
    exit (1);
  }
--- 505,512 ----
  usage ()
  {
    fprintf (stderr, "\
! Usage: %s [-aimqsuwHT] [--all] [--count] [--idle] [--heading] [--message]\n\
!        [--mesg] [--writable] [file] [am i]\n",
  	   program_name);
    exit (1);
  }
*** stty.c.ORIG	Wed Oct 28 15:19:41 1992
--- stty.c	Mon Dec 21 21:18:02 1992
***************
*** 99,104 ****
--- 99,107 ----
  #if defined(VREPRINT) && !defined(CRPRNT)
  #define	CRPRNT Control ('r')
  #endif
+ #if defined(VDISCARD) && !defined(CFLUSH)
+ #define	CFLUSH Control ('o')
+ #endif
  #if defined(VWERASE) && !defined(CWERASE)
  #define	CWERASE Control ('w')
  #endif
***************
*** 176,181 ****
--- 179,190 ----
  #ifdef CRTSCTS
    {"crtscts", control, REV, CRTSCTS, 0},
  #endif
+ #ifdef LOBLK
+   {"loblk", control, REV, LOBLK, 0},
+ #endif
+ #ifdef PAREXT
+   {"parext", control, REV, PAREXT, 0},
+ #endif
  
    {"ignbrk", input, SANE_UNSET | REV, IGNBRK, 0},
    {"brkint", input, SANE_SET | REV, BRKINT, 0},
***************
*** 279,284 ****
--- 288,302 ----
    {"echoke", local, SANE_SET | REV, ECHOKE, 0},
    {"crtkill", local, REV | OMIT, ECHOKE, 0},
  #endif
+ #ifdef DEFECHO
+   {"defecho", local, REV, DEFECHO, 0},
+ #endif
+ #ifdef FLUSHO
+   {"flusho", local, REV, FLUSHO, 0},
+ #endif
+ #ifdef PENDIN
+   {"pendin", local, REV, PENDIN, 0},
+ #endif
  
    {"evenp", combination, REV | OMIT, 0, 0},
    {"parity", combination, REV | OMIT, 0, 0},
***************
*** 340,345 ****
--- 358,366 ----
  #ifdef VREPRINT
    {"rprnt", CRPRNT, VREPRINT},
  #endif
+ #ifdef VDISCARD
+   {"flush", CFLUSH, VDISCARD},
+ #endif
  #ifdef VWERASE
    {"werase", CWERASE, VWERASE},
  #endif
***************
*** 499,505 ****
  	      if (optind == argc - 1)
  		error (1, 0, "missing argument to `%s'", argv[optind]);
  	      ++optind;
! 	      set_window_size ((int) integer_arg (argv[optind]), -1);
  	    }
  	  else if (!strcmp (argv[optind], "cols")
  		   || !strcmp (argv[optind], "columns"))
--- 520,526 ----
  	      if (optind == argc - 1)
  		error (1, 0, "missing argument to `%s'", argv[optind]);
  	      ++optind;
! 	      set_window_size ((int) integer_arg (argv[optind]), -1, -1, -1);
  	    }
  	  else if (!strcmp (argv[optind], "cols")
  		   || !strcmp (argv[optind], "columns"))
***************
*** 507,514 ****
  	      if (optind == argc - 1)
  		error (1, 0, "missing argument to `%s'", argv[optind]);
  	      ++optind;
! 	      set_window_size (-1, (int) integer_arg (argv[optind]));
  	    }
  	  else if (!strcmp (argv[optind], "size"))
  	    display_window_size (0);
  #endif
--- 528,551 ----
  	      if (optind == argc - 1)
  		error (1, 0, "missing argument to `%s'", argv[optind]);
  	      ++optind;
! 	      set_window_size (-1, (int) integer_arg (argv[optind]), -1, -1);
  	    }
+ #ifdef sun
+ 	  else if (!strcmp (argv[optind], "xpixels"))
+ 	    {
+ 	      if (optind == argc - 1)
+ 		error (1, 0, "missing argument to `%s'", argv[optind]);
+ 	      ++optind;
+ 	      set_window_size (-1, -1, (int) integer_arg (argv[optind]), -1);
+ 	    }
+ 	  else if (!strcmp (argv[optind], "ypixels"))
+ 	    {
+ 	      if (optind == argc - 1)
+ 		error (1, 0, "missing argument to `%s'", argv[optind]);
+ 	      ++optind;
+ 	      set_window_size (-1, -1, -1, (int) integer_arg (argv[optind]));
+ 	    }
+ #endif
  	  else if (!strcmp (argv[optind], "size"))
  	    display_window_size (0);
  #endif
***************
*** 780,787 ****
  
  #ifdef TIOCGWINSZ
  void
! set_window_size (rows, cols)
!      int rows, cols;
  {
    struct winsize win;
  
--- 817,824 ----
  
  #ifdef TIOCGWINSZ
  void
! set_window_size (rows, cols, xpixels, ypixels)
!      int rows, cols, xpixels, ypixels;
  {
    struct winsize win;
  
***************
*** 791,796 ****
--- 828,839 ----
      win.ws_row = rows;
    if (cols >= 0)
      win.ws_col = cols;
+ #ifdef sun
+   if (xpixels >= 0)
+     win.ws_xpixel = xpixels;
+   if (ypixels >= 0)
+     win.ws_ypixel = ypixels;
+ #endif
    if (ioctl (0, TIOCSWINSZ, (char *) &win))
      error (1, errno, "standard input");
  }
***************
*** 803,809 ****
--- 846,858 ----
  
    if (ioctl (0, TIOCGWINSZ, (char *) &win))
      error (1, errno, "standard input");
+ #ifdef sun
+   wrapf (fancy ? "rows %d; columns %d; ypixels %d; xpixels" :
+ 	         "%d %d %d %d\n", 
+ 	 win.ws_row, win.ws_col, win.ws_ypixel, win.ws_xpixel);
+ #else
    wrapf (fancy ? "rows %d; columns %d;" : "%d %d\n", win.ws_row, win.ws_col);
+ #endif
    if (!fancy)
      current_col = 0;
  }
*** ../configure.BAK	Thu Oct 22 20:44:31 1992
--- ../configure	Mon Dec 21 17:45:35 1992
***************
*** 486,492 ****
  echo checking for broken window size ioctl
  echo "#include <sys/types.h>
  #include <termios.h>" > conftest.c
! test -n "$have_ptem" && echo "#include <sys/ptem.h>" >> conftest.c
  echo "main() {
  #ifndef TIOCGWINSZ
  exit(0);
--- 486,493 ----
  echo checking for broken window size ioctl
  echo "#include <sys/types.h>
  #include <termios.h>" > conftest.c
! test -n "$have_ptem" && echo "#include <sys/stream.h>
! #include <sys/ptem.h>" >> conftest.c
  echo "main() {
  #ifndef TIOCGWINSZ
  exit(0);


Newsgroups: gnu.utils.bug