home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / utils / bug / 2266 < prev    next >
Encoding:
Text File  |  1992-12-22  |  20.9 KB  |  792 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!klinzhai.rutgers.edu!hedrick
  3. From: hedrick@klinzhai.rutgers.edu (Charles Hedrick)
  4. Subject: changes for shell utils for SVr4
  5. Message-ID: <9212222027.AA21469@klinzhai.rutgers.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 22 Dec 1992 20:27:52 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 779
  12.  
  13. The following changes to shellutils.1.18 are for System V release 4 at
  14. Rutgers.  Note that I've simply edited the files, rather than putting
  15. the right support in configure, so you'll no doubt want to reorganize
  16. them somewhere.
  17.  
  18. These programs are affected by the following Rutgers programming
  19. conventions:
  20.  
  21.   - all programs that initialize the environment for a user
  22.     must read /etc/default/login.  This is a feature of svr4 that 
  23.     I really like.  However I think the ATT code only uses it
  24.     in login.  We do it in rlogind, etc., also.  Note that EDITOR
  25.     and MANPATH are Rutgers extensions.
  26.  
  27.   - all programs that take passwords must understand Kerberos
  28.     v5.  (Actually this patch isn't complete, because I
  29.     don't have the SecureID code in yet.) The specific convention
  30.     of putting ##principalname in the password field for
  31.     kerberized users is Rutgers-specific.
  32.  
  33.   - all programs must support usernames of at least 32 characters
  34.     (the maximum size defined by SVr4)
  35.  
  36. su:
  37.   - for svr4, make it get initial environment variable values from
  38.     /etc/default/login.  
  39.   - use kerberos for password checking where appropriate.
  40.  
  41. who:
  42.   - make it read utmpx instead of utmp.  In svr4, utmp has a truncated
  43.     user name (8 characters only) and no hostname.  You need
  44.     utmpx to get the full 32-char user name and the hostname.
  45.     Note that we have to hardcode the field widths.  With the
  46.     new extended types, the widths are enough that we really
  47.     have to truncate them in order to get a reasonable output
  48.     format.
  49.   - add the -a option, which is designed for looking at wtmpx, though
  50.     it can also be used for debugging of code that manipulates utmpx.
  51.     Wtmpx can get arbitrarily big, so don't read the whole file
  52.     into memory with -a.
  53.  
  54. stty 
  55.   - add support for various bits and characters present in SVr4.  While
  56.     this does work, I ended up deciding to use Sun's stty.  There
  57.     are too many additional features, including some bizarre
  58.     fields used to control international character sets, and
  59.     features controlling X.25 lines.  It would take a bit of work
  60.     to reverse engineer all of that.  I don't really see the point,
  61.     since Sun's stty works fine.
  62.  
  63. configure:
  64.   - claimed that TIOCGWINSZ is broken.  It's not.  The test program
  65.     forgot to include <sys/stream.h>.
  66.  
  67.  
  68. *** Makefile.ORIG    Tue Dec 22 15:07:38 1992
  69. --- Makefile    Mon Dec 21 22:04:42 1992
  70. ***************
  71. *** 31,36 ****
  72. --- 31,40 ----
  73.   PROGS = basename date dirname echo env expr false groups id logname \
  74.   pathchk printenv printf sleep tee test true tty who whoami yes  uname nice nohup stty
  75.   
  76. + KRB=../../kerberos5
  77. + 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      
  78.   all: $(PROGS) su
  79.   
  80.   .c.o:
  81. ***************
  82. *** 131,138 ****
  83.       $(CC) $(LDFLAGS) -o $@ sleep.o ../lib/libshu.a version.o $(LIBS)
  84.   
  85.   su: su.o
  86. !     $(CC) $(LDFLAGS) -o $@ su.o ../lib/libshu.a version.o $(LIBS)
  87.   
  88.   tee: tee.o
  89.       $(CC) $(LDFLAGS) -o $@ tee.o ../lib/libshu.a version.o $(LIBS)
  90.   
  91. --- 135,144 ----
  92.       $(CC) $(LDFLAGS) -o $@ sleep.o ../lib/libshu.a version.o $(LIBS)
  93.   
  94.   su: su.o
  95. !     $(CC) $(LDFLAGS) -o $@ su.o ../lib/libshu.a version.o $(LIBS) \
  96. ! ${KRB}/pwdauthd/pwdkrb.o ${KRB}/pwdauthd/kdebug.o ${KRBL} -lnsl -lresolv -lsocket -lc -Xlinker -R/usr/ucblib -L/usr/ucblib -lucb -lelf
  97.   
  98.   tee: tee.o
  99.       $(CC) $(LDFLAGS) -o $@ tee.o ../lib/libshu.a version.o $(LIBS)
  100.   
  101. ***************
  102. *** 167,173 ****
  103.   # Special rules for some .o files.
  104.   
  105.   su.o: su.c
  106. !     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DSYSLOG_FAILURE -DSYSLOG_SUCCESS -I$(srcdir)/../lib $(srcdir)/su.c
  107.   
  108.   test.o: test.c
  109.       $(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DTEST_STANDALONE -I$(srcdir)/../lib $(srcdir)/test.c
  110. --- 173,179 ----
  111.   # Special rules for some .o files.
  112.   
  113.   su.o: su.c
  114. !     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DRUTGERS -DSYSLOG_FAILURE -DSYSLOG_SUCCESS -I$(srcdir)/../lib $(srcdir)/su.c
  115.   
  116.   test.o: test.c
  117.       $(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -DTEST_STANDALONE -I$(srcdir)/../lib $(srcdir)/test.c
  118. *** su.c.ORIG    Wed Oct 28 14:58:42 1992
  119. --- su.c    Mon Dec 21 22:41:16 1992
  120. ***************
  121. *** 115,126 ****
  122.   #include <shadow.h>
  123.   #endif
  124.   
  125.   /* The default PATH for simulated logins to non-superuser accounts.  */
  126.   #define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
  127.   /* The default PATH for simulated logins to superuser accounts.  */
  128.   #define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
  129.   
  130.   /* The shell to run if none is given in the user's passwd entry.  */
  131.   #define DEFAULT_SHELL "/bin/sh"
  132.   
  133. --- 115,138 ----
  134.   #include <shadow.h>
  135.   #endif
  136.   
  137. + #ifdef RUTGERS
  138. + #include <wait.h>
  139. + #endif
  140. + #ifdef __svr4__
  141. + #define DEFAULT_LOGIN_PATH "/usr/bin"
  142. + #define DEFAULT_ROOT_LOGIN_PATH "/usr/bin"
  143. + #else
  144.   /* The default PATH for simulated logins to non-superuser accounts.  */
  145.   #define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
  146.   /* The default PATH for simulated logins to superuser accounts.  */
  147.   #define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
  148.   
  149. + #endif
  150.   /* The shell to run if none is given in the user's passwd entry.  */
  151.   #define DEFAULT_SHELL "/bin/sh"
  152.   
  153. ***************
  154. *** 277,282 ****
  155. --- 289,295 ----
  156.        struct passwd *pw;
  157.   {
  158.     char *unencrypted, *encrypted, *correct;
  159. +   int rval;
  160.   #ifdef HAVE_SHADOW_H
  161.     /* Shadow passwd stuff for SVR3 and maybe other systems.  */
  162.     struct spwd *sp = getspnam (pw->pw_name);
  163. ***************
  164. *** 292,300 ****
  165.       return 1;
  166.   
  167.     unencrypted = getpass ("Password:");
  168. !   encrypted = crypt (unencrypted, correct);
  169. !   bzero (unencrypted, strlen (unencrypted));
  170. !   return strcmp (encrypted, correct) == 0;
  171.   }
  172.   
  173.   /* Update `environ' for the new shell based on PW, with SHELL being
  174. --- 305,351 ----
  175.       return 1;
  176.   
  177.     unencrypted = getpass ("Password:");
  178. ! #ifdef RUTGERS
  179. !   if (correct[0] == '#' && 
  180. !       correct[1] == '#') {
  181. !     int pid;
  182. !     int status;
  183. !     char prin_name[512], *encpw;
  184. !     encpw = correct+2;
  185. !     if (*encpw >= 'A' && *encpw <= 'Z') {
  186. !       strcpy(prin_name,"+");
  187. !       strcat(prin_name,encpw);
  188. !       strcat(prin_name,"+");
  189. !     } else
  190. !       strcpy(prin_name,encpw);
  191. !     pid = fork ();
  192. !     if (pid == -1) {
  193. !       bzero (unencrypted, strlen (unencrypted));
  194. !       printf("Fork failed.\n");
  195. !       rval = 0;
  196. !     } else if (pid == 0) {
  197. !       setuid(0);  /* without this, the replay cache code won't work */
  198. !       rval = pwdkrb(prin_name, unencrypted, pw->pw_uid);
  199. !       if (rval) {
  200. !     printf("%s\n", error_message(rval)); /* com_err*/
  201. !     exit(1);
  202. !       } else
  203. !     exit(0);
  204. !     } else {
  205. !       bzero (unencrypted, strlen (unencrypted));
  206. !       waitpid (pid, &status, 0);
  207. !       rval = WEXITSTATUS(status) == 0;
  208. !     }
  209. !   } else
  210. ! #endif
  211. !     {
  212. !       encrypted = crypt (unencrypted, correct);    
  213. !       bzero (unencrypted, strlen (unencrypted));
  214. !       rval = strcmp (encrypted, correct) == 0;
  215. !     }
  216. !   return rval;
  217.   }
  218.   
  219.   /* Update `environ' for the new shell based on PW, with SHELL being
  220. ***************
  221. *** 309,314 ****
  222. --- 360,406 ----
  223.   
  224.     if (simulate_login)
  225.       {
  226. + #ifdef __svr4__
  227. +       char *tz, *hz, *path, *supath, *umaskstr, *editor, *manpath;
  228. +       int umaskval;
  229. +       char defbuf[256];
  230. +       FILE *deffile;
  231. +       deffile = fopen("/etc/default/login", "r");
  232. +       if (deffile) {
  233. +     while (fgets(defbuf, sizeof(defbuf), deffile) == defbuf) {
  234. +       char *lf = strchr(defbuf, '\n');
  235. +       if (lf)
  236. +         *lf = 0;
  237. +       if (strncmp(defbuf, "TIMEZONE=", sizeof("TIMEZONE=")-1) == 0)
  238. +         tz = strdup(defbuf + sizeof("TIMEZONE=")-1);
  239. +       else if (strncmp(defbuf, "HZ=", sizeof("HZ=")-1) == 0)
  240. +         hz = strdup(defbuf + sizeof("HZ=")-1);
  241. +       else if (strncmp(defbuf, "PATH=", sizeof("PATH=")-1) == 0)
  242. +         path = strdup(defbuf + sizeof("PATH=")-1);
  243. +       else if (strncmp(defbuf, "SUPATH=", sizeof("SUPATH=")-1) == 0)
  244. +         supath = strdup(defbuf + sizeof("SUPATH=")-1);
  245. +       else if (strncmp(defbuf, "UMASK=", sizeof("UMASK=")-1) == 0)
  246. +         umaskstr = strdup(defbuf + sizeof("UMASK=")-1);
  247. +       else if (strncmp(defbuf, "EDITOR=", sizeof("EDITOR=")-1) == 0)
  248. +         editor = strdup(defbuf + sizeof("EDITOR=")-1);
  249. +       else if (strncmp(defbuf, "MANPATH=", sizeof("MANPATH=")-1) == 0)
  250. +         manpath = strdup(defbuf + sizeof("MANPATH=")-1);
  251. +     }
  252. +       }
  253. +       if (! tz)
  254. +     tz = getenv("TZ");
  255. +       if (! hz)
  256. +     hz = "100";
  257. +       if (! path)
  258. +     path = DEFAULT_LOGIN_PATH;
  259. +       if (! supath)
  260. +     supath = DEFAULT_ROOT_LOGIN_PATH;
  261. +       if (umaskstr && sscanf(umaskstr, "%o", &umaskval) == 1 && umaskval)
  262. +     umask(umaskval);
  263. + #endif
  264.         /* Leave TERM unchanged.  Set HOME, SHELL, USER, LOGNAME, PATH.
  265.            Unset all other environment variables.  */
  266.         term = getenv ("TERM");
  267. ***************
  268. *** 320,327 ****
  269. --- 412,430 ----
  270.         xputenv (concat ("SHELL", "=", shell));
  271.         xputenv (concat ("USER", "=", pw->pw_name));
  272.         xputenv (concat ("LOGNAME", "=", pw->pw_name));
  273. + #ifdef __svr4__
  274. +       if (tz)
  275. +     xputenv (concat ("TZ", "=", tz));
  276. +       xputenv (concat ("HZ", "=", hz));
  277. +       if (editor)
  278. +     xputenv (concat ("EDITOR", "=", editor));
  279. +       if (manpath)
  280. +     xputenv (concat ("MANPATH", "=", manpath));
  281. +       xputenv (concat ("PATH", "=", pw->pw_uid ? path : supath));
  282. + #else
  283.         xputenv (concat ("PATH", "=", pw->pw_uid
  284.                  ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH));
  285. + #endif
  286.       }
  287.     else
  288.       {
  289. *** who.c.ORIG    Wed Oct 28 15:02:50 1992
  290. --- who.c    Tue Dec 22 01:32:07 1992
  291. ***************
  292. *** 24,29 ****
  293. --- 24,30 ----
  294.      idle: -u
  295.   
  296.      Options:
  297. +    -a        All entries, extended format
  298.      -m        Same as 'who am i', for POSIX.
  299.      -q        Only user names and # logged on; overrides all other options.
  300.      -s        Name, line, time (default).
  301. ***************
  302. *** 34,40 ****
  303. --- 35,58 ----
  304.   
  305.   #include <stdio.h>
  306.   #include <sys/types.h>
  307. + #ifdef __svr4__
  308. + #include <utmpx.h>
  309. + #define utmp utmpx
  310. + #define ut_time ut_tv.tv_sec
  311. + #undef UTMP_FILE
  312. + #define UTMP_FILE "/var/adm/utmpx"
  313. + #define HAVE_UT_HOST
  314. + #define UTNAMEWID 16
  315. + #define UTLINEWID 12
  316. + #define UTHOSTWID 30
  317. + #else
  318.   #include <utmp.h>
  319. + #define UTNAMEWID  (sizeof (this->ut_name))
  320. + #define UTLINEWID  (sizeof (this->ut_line))
  321. + #define UTHOSTWID  (sizeof (this->ut_host))
  322. + #endif
  323.   #include <time.h>
  324.   #include <getopt.h>
  325.   #ifndef _POSIX_SOURCE
  326. ***************
  327. *** 50,55 ****
  328. --- 68,78 ----
  329.   #endif                /* !_PATH_UTMP */
  330.   #endif                /* !UTMP_FILE */
  331.   
  332. + #ifdef __svr4__
  333. + /* for MAXHOSTNAMELEN */
  334. + #include "netdb.h"
  335. + #endif
  336.   #ifndef MAXHOSTNAMELEN
  337.   #define MAXHOSTNAMELEN 64
  338.   #endif
  339. ***************
  340. *** 78,83 ****
  341. --- 101,109 ----
  342.      Ignored for `who am i'. */
  343.   int short_list;
  344.   
  345. + /* If nonzero, show all file entries, in extended format */
  346. + int include_all;
  347.   /* If nonzero, display the hours:minutes since each user has touched
  348.      the keyboard, or "." if within the last minute, or "old" if
  349.      not within the last day. */
  350. ***************
  351. *** 92,97 ****
  352. --- 118,124 ----
  353.   
  354.   struct option longopts[] =
  355.   {
  356. +   {"all", 0, NULL, 'a'},
  357.     {"count", 0, NULL, 'q'},
  358.     {"idle", 0, NULL, 'u'},
  359.     {"heading", 0, NULL, 'H'},
  360. ***************
  361. *** 111,121 ****
  362.   
  363.     program_name = argv[0];
  364.   
  365. !   while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind))
  366.        != EOF)
  367.       {
  368.         switch (optc)
  369.       {
  370.       case 'm':
  371.         my_line_only = 1;
  372.         break;
  373. --- 138,152 ----
  374.   
  375.     program_name = argv[0];
  376.   
  377. !   while ((optc = getopt_long (argc, argv, "aimqsuwHT", longopts, &longind))
  378.        != EOF)
  379.       {
  380.         switch (optc)
  381.       {
  382. +     case 'a':
  383. +       include_all = 1;
  384. +       break;
  385.       case 'm':
  386.         my_line_only = 1;
  387.         break;
  388. ***************
  389. *** 186,196 ****
  390.   {
  391.     int users;
  392.   
  393. !   users = read_utmp (filename);
  394. !   if (short_list)
  395. !     list_entries (users);
  396. !   else
  397. !     scan_entries (users);
  398.   }
  399.   
  400.   /* Read the utmp file FILENAME into UTMP_CONTENTS and return the
  401. --- 217,231 ----
  402.   {
  403.     int users;
  404.   
  405. !   if (include_all)
  406. !     list_file (filename);
  407. !   else {
  408. !     users = read_utmp (filename);
  409. !     if (short_list)
  410. !       list_entries (users);
  411. !     else
  412. !       scan_entries (users);
  413. !   }
  414.   }
  415.   
  416.   /* Read the utmp file FILENAME into UTMP_CONTENTS and return the
  417. ***************
  418. *** 226,233 ****
  419. --- 261,296 ----
  420.     return file_stats.st_size / sizeof (struct utmp);
  421.   }
  422.   
  423. + /*
  424. +  * list_file is used for -a.  This is commonly used for dumping
  425. +  * wtmp.  That can grow arbitrarily large, so we don't really
  426. +  * want to read it into memory first.
  427. +  */
  428. + list_file (filename)
  429. +      char *filename;
  430. + {
  431. +   FILE *fp;
  432. +   struct utmp utmp;
  433. +   fp = fopen (filename, "r");
  434. +   if (! fp)
  435. +     error (1, errno, "%s", filename);
  436. +   while (fread (&utmp, sizeof(utmp), 1, fp) == 1)
  437. +     print_entry(&utmp);
  438. +   fclose(fp);
  439. + }
  440.   /* Display a line of information about entry THIS. */
  441.   
  442. + #ifdef __svr4__
  443. + char *uttypes[] = {"EMPTY ", "RUNLVL", "BOOT  ", "OLDTIM", "NEWTIM",
  444. +          "INIT  ", "LOGIN ", "USER  ", "DEAD  ", "ACCTNG"};
  445. + #endif
  446.   void
  447.   print_entry (this)
  448.        struct utmp *this;
  449. ***************
  450. *** 251,262 ****
  451.       }
  452.     
  453.     printf ("%-*.*s",
  454. !       sizeof (this->ut_name), sizeof (this->ut_name),
  455.         this->ut_name);
  456.     if (include_mesg)
  457.       printf ("  %c  ", mesg);
  458.     printf (" %-*.*s",
  459. !       sizeof (this->ut_line), sizeof (this->ut_line),
  460.         this->ut_line);
  461.     printf (" %-12.12s", ctime (&this->ut_time) + 4);
  462.     if (include_idle)
  463. --- 314,325 ----
  464.       }
  465.     
  466.     printf ("%-*.*s",
  467. !       UTNAMEWID, UTNAMEWID,
  468.         this->ut_name);
  469.     if (include_mesg)
  470.       printf ("  %c  ", mesg);
  471.     printf (" %-*.*s",
  472. !       UTLINEWID, UTLINEWID,
  473.         this->ut_line);
  474.     printf (" %-12.12s", ctime (&this->ut_time) + 4);
  475.     if (include_idle)
  476. ***************
  477. *** 266,276 ****
  478.         else
  479.       printf ("   .  ");
  480.       }
  481.   #ifdef HAVE_UT_HOST
  482.     if (this->ut_host[0])
  483. !     printf (" (%-.*s)", sizeof (this->ut_host), this->ut_host);
  484.   #endif
  485.     putchar ('\n');
  486.   }
  487.   
  488. --- 329,354 ----
  489.         else
  490.       printf ("   .  ");
  491.       }
  492. + #ifdef __svr4__
  493. +   if (include_all) {
  494. +     if ((this->ut_type) >= 0 && (this->ut_type) <= UTMAXTYPE)
  495. +       printf(" %s", uttypes[this->ut_type]);
  496. +     else
  497. +       printf(" type=%d", this->ut_type);
  498. +     if (this->ut_id[0])
  499. +       printf(" id=%4.4s", this->ut_id);
  500. +     if (this->ut_pid)
  501. +       printf(" pid=%d", this->ut_pid);
  502. +     if (this->ut_exit.e_termination)
  503. +       printf(" term=%d", this->ut_exit.e_termination);
  504. +     if (this->ut_exit.e_exit)
  505. +       printf(" exit=%d", this->ut_exit.e_exit);
  506. +   }
  507. + #endif
  508.   #ifdef HAVE_UT_HOST
  509.     if (this->ut_host[0])
  510. !     printf (" (%-.*s)", UTHOSTWID, this->ut_host);
  511.   #endif
  512.     putchar ('\n');
  513.   }
  514.   
  515. ***************
  516. *** 305,314 ****
  517.   {
  518.     struct utmp *ut;
  519.   
  520. !   printf ("%-*s ", sizeof (ut->ut_name), "USER");
  521.     if (include_mesg)
  522.       printf ("MESG ");
  523. !   printf ("%-*s ", sizeof (ut->ut_line), "LINE");
  524.     printf ("LOGIN-TIME   ");
  525.     if (include_idle)
  526.       printf ("IDLE  ");
  527. --- 383,392 ----
  528.   {
  529.     struct utmp *ut;
  530.   
  531. !   printf ("%-*s ", UTNAMEWID, "USER");
  532.     if (include_mesg)
  533.       printf ("MESG ");
  534. !   printf ("%-*s ", UTLINEWID, "LINE");
  535.     printf ("LOGIN-TIME   ");
  536.     if (include_idle)
  537.       printf ("IDLE  ");
  538. ***************
  539. *** 328,338 ****
  540.   
  541.     while (n--)
  542.       {
  543. !       if (this->ut_name[0]
  544.   #ifdef USER_PROCESS
  545.         && this->ut_type == USER_PROCESS
  546.   #endif
  547. !      )
  548.       print_entry (this);
  549.         this++;
  550.       }
  551. --- 406,416 ----
  552.   
  553.     while (n--)
  554.       {
  555. !       if (include_all || (this->ut_name[0]
  556.   #ifdef USER_PROCESS
  557.         && this->ut_type == USER_PROCESS
  558.   #endif
  559. !      ))
  560.       print_entry (this);
  561.         this++;
  562.       }
  563. ***************
  564. *** 427,434 ****
  565.   usage ()
  566.   {
  567.     fprintf (stderr, "\
  568. ! Usage: %s [-imqsuwHT] [--count] [--idle] [--heading] [--message] [--mesg]\n\
  569. !        [--writable] [file] [am i]\n",
  570.          program_name);
  571.     exit (1);
  572.   }
  573. --- 505,512 ----
  574.   usage ()
  575.   {
  576.     fprintf (stderr, "\
  577. ! Usage: %s [-aimqsuwHT] [--all] [--count] [--idle] [--heading] [--message]\n\
  578. !        [--mesg] [--writable] [file] [am i]\n",
  579.          program_name);
  580.     exit (1);
  581.   }
  582. *** stty.c.ORIG    Wed Oct 28 15:19:41 1992
  583. --- stty.c    Mon Dec 21 21:18:02 1992
  584. ***************
  585. *** 99,104 ****
  586. --- 99,107 ----
  587.   #if defined(VREPRINT) && !defined(CRPRNT)
  588.   #define    CRPRNT Control ('r')
  589.   #endif
  590. + #if defined(VDISCARD) && !defined(CFLUSH)
  591. + #define    CFLUSH Control ('o')
  592. + #endif
  593.   #if defined(VWERASE) && !defined(CWERASE)
  594.   #define    CWERASE Control ('w')
  595.   #endif
  596. ***************
  597. *** 176,181 ****
  598. --- 179,190 ----
  599.   #ifdef CRTSCTS
  600.     {"crtscts", control, REV, CRTSCTS, 0},
  601.   #endif
  602. + #ifdef LOBLK
  603. +   {"loblk", control, REV, LOBLK, 0},
  604. + #endif
  605. + #ifdef PAREXT
  606. +   {"parext", control, REV, PAREXT, 0},
  607. + #endif
  608.   
  609.     {"ignbrk", input, SANE_UNSET | REV, IGNBRK, 0},
  610.     {"brkint", input, SANE_SET | REV, BRKINT, 0},
  611. ***************
  612. *** 279,284 ****
  613. --- 288,302 ----
  614.     {"echoke", local, SANE_SET | REV, ECHOKE, 0},
  615.     {"crtkill", local, REV | OMIT, ECHOKE, 0},
  616.   #endif
  617. + #ifdef DEFECHO
  618. +   {"defecho", local, REV, DEFECHO, 0},
  619. + #endif
  620. + #ifdef FLUSHO
  621. +   {"flusho", local, REV, FLUSHO, 0},
  622. + #endif
  623. + #ifdef PENDIN
  624. +   {"pendin", local, REV, PENDIN, 0},
  625. + #endif
  626.   
  627.     {"evenp", combination, REV | OMIT, 0, 0},
  628.     {"parity", combination, REV | OMIT, 0, 0},
  629. ***************
  630. *** 340,345 ****
  631. --- 358,366 ----
  632.   #ifdef VREPRINT
  633.     {"rprnt", CRPRNT, VREPRINT},
  634.   #endif
  635. + #ifdef VDISCARD
  636. +   {"flush", CFLUSH, VDISCARD},
  637. + #endif
  638.   #ifdef VWERASE
  639.     {"werase", CWERASE, VWERASE},
  640.   #endif
  641. ***************
  642. *** 499,505 ****
  643.             if (optind == argc - 1)
  644.           error (1, 0, "missing argument to `%s'", argv[optind]);
  645.             ++optind;
  646. !           set_window_size ((int) integer_arg (argv[optind]), -1);
  647.           }
  648.         else if (!strcmp (argv[optind], "cols")
  649.              || !strcmp (argv[optind], "columns"))
  650. --- 520,526 ----
  651.             if (optind == argc - 1)
  652.           error (1, 0, "missing argument to `%s'", argv[optind]);
  653.             ++optind;
  654. !           set_window_size ((int) integer_arg (argv[optind]), -1, -1, -1);
  655.           }
  656.         else if (!strcmp (argv[optind], "cols")
  657.              || !strcmp (argv[optind], "columns"))
  658. ***************
  659. *** 507,514 ****
  660.             if (optind == argc - 1)
  661.           error (1, 0, "missing argument to `%s'", argv[optind]);
  662.             ++optind;
  663. !           set_window_size (-1, (int) integer_arg (argv[optind]));
  664.           }
  665.         else if (!strcmp (argv[optind], "size"))
  666.           display_window_size (0);
  667.   #endif
  668. --- 528,551 ----
  669.             if (optind == argc - 1)
  670.           error (1, 0, "missing argument to `%s'", argv[optind]);
  671.             ++optind;
  672. !           set_window_size (-1, (int) integer_arg (argv[optind]), -1, -1);
  673.           }
  674. + #ifdef sun
  675. +       else if (!strcmp (argv[optind], "xpixels"))
  676. +         {
  677. +           if (optind == argc - 1)
  678. +         error (1, 0, "missing argument to `%s'", argv[optind]);
  679. +           ++optind;
  680. +           set_window_size (-1, -1, (int) integer_arg (argv[optind]), -1);
  681. +         }
  682. +       else if (!strcmp (argv[optind], "ypixels"))
  683. +         {
  684. +           if (optind == argc - 1)
  685. +         error (1, 0, "missing argument to `%s'", argv[optind]);
  686. +           ++optind;
  687. +           set_window_size (-1, -1, -1, (int) integer_arg (argv[optind]));
  688. +         }
  689. + #endif
  690.         else if (!strcmp (argv[optind], "size"))
  691.           display_window_size (0);
  692.   #endif
  693. ***************
  694. *** 780,787 ****
  695.   
  696.   #ifdef TIOCGWINSZ
  697.   void
  698. ! set_window_size (rows, cols)
  699. !      int rows, cols;
  700.   {
  701.     struct winsize win;
  702.   
  703. --- 817,824 ----
  704.   
  705.   #ifdef TIOCGWINSZ
  706.   void
  707. ! set_window_size (rows, cols, xpixels, ypixels)
  708. !      int rows, cols, xpixels, ypixels;
  709.   {
  710.     struct winsize win;
  711.   
  712. ***************
  713. *** 791,796 ****
  714. --- 828,839 ----
  715.       win.ws_row = rows;
  716.     if (cols >= 0)
  717.       win.ws_col = cols;
  718. + #ifdef sun
  719. +   if (xpixels >= 0)
  720. +     win.ws_xpixel = xpixels;
  721. +   if (ypixels >= 0)
  722. +     win.ws_ypixel = ypixels;
  723. + #endif
  724.     if (ioctl (0, TIOCSWINSZ, (char *) &win))
  725.       error (1, errno, "standard input");
  726.   }
  727. ***************
  728. *** 803,809 ****
  729. --- 846,858 ----
  730.   
  731.     if (ioctl (0, TIOCGWINSZ, (char *) &win))
  732.       error (1, errno, "standard input");
  733. + #ifdef sun
  734. +   wrapf (fancy ? "rows %d; columns %d; ypixels %d; xpixels" :
  735. +              "%d %d %d %d\n", 
  736. +      win.ws_row, win.ws_col, win.ws_ypixel, win.ws_xpixel);
  737. + #else
  738.     wrapf (fancy ? "rows %d; columns %d;" : "%d %d\n", win.ws_row, win.ws_col);
  739. + #endif
  740.     if (!fancy)
  741.       current_col = 0;
  742.   }
  743. *** ../configure.BAK    Thu Oct 22 20:44:31 1992
  744. --- ../configure    Mon Dec 21 17:45:35 1992
  745. ***************
  746. *** 486,492 ****
  747.   echo checking for broken window size ioctl
  748.   echo "#include <sys/types.h>
  749.   #include <termios.h>" > conftest.c
  750. ! test -n "$have_ptem" && echo "#include <sys/ptem.h>" >> conftest.c
  751.   echo "main() {
  752.   #ifndef TIOCGWINSZ
  753.   exit(0);
  754. --- 486,493 ----
  755.   echo checking for broken window size ioctl
  756.   echo "#include <sys/types.h>
  757.   #include <termios.h>" > conftest.c
  758. ! test -n "$have_ptem" && echo "#include <sys/stream.h>
  759. ! #include <sys/ptem.h>" >> conftest.c
  760.   echo "main() {
  761.   #ifndef TIOCGWINSZ
  762.   exit(0);
  763.  
  764.  
  765.