home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume34 / u386mon / patch01 next >
Text File  |  1992-12-08  |  31KB  |  1,228 lines

  1. Newsgroups: comp.sources.misc
  2. From: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  3. Subject:  v34i017:  u386mon - SVR3 performance/status monitor v2.60, Patch01
  4. Message-ID: <1992Dec7.231937.2049@sparky.imd.sterling.com>
  5. X-Md4-Signature: ff7256177230fd25eff721e42e6eecfc
  6. Date: Mon, 7 Dec 1992 23:19:37 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  10. Posting-number: Volume 34, Issue 17
  11. Archive-name: u386mon/patch01
  12. Environment: SYSVR3
  13. Patch-To: u386mon: Volume 33, Issue 110-117
  14.  
  15. This excellent patch set was sent to me by Uwe Doering
  16. <gemini@geminix.in-berlin.de>.  This patch direct addresses compile
  17. problems with all non-SCO boxes (most have no 'bootstr' in bootinfo).
  18. As you can see, he's done other good work.
  19.  
  20. His comments:
  21.  
  22. I've installed u386mon 2.60, uusnap and siomon a few days ago and have
  23. since made a few changes/bug fixes. They are appended below as a
  24. context diff.
  25.  
  26. Here are some comments on the changes:
  27.  
  28. - In all three programs, SIO_IS_FAS now overrides the M_UNIX define.
  29.   That is, if SIO_IS_FAS is defined it is save to assume that the user
  30.   really wants to compile in the sio functions regardless of whether
  31.   he/she uses SCO UNIX or not. This assumption can be made because
  32.   I made the necessary changes to allow the use of the standard
  33.   FAS device names (`ttyF00', `ttyFM00' etc.) for UNIX flavours
  34.   != SCO UNIX. So everyone who runs FAS can use the sio functions
  35.   now. On SCO UNIX the SCO tty name conventions are used, and on
  36.   all other UNIX flavours the standard FAS names are assumed.
  37.  
  38. - The problem with the FAS support is that there are two tty
  39.   structures for each port. This consumes valuable space on the
  40.   screen, and siomon and uusnap wouldn't be able to properly
  41.   work with more than eight FAS ports. This definitely bugged me. :-)
  42.  
  43.   I came up with the following idea: One isn't really interested
  44.   in both tty structures at the same time. That is, during a
  45.   dialin a dialout isn't possible, anyway, and the other way round,
  46.   during a dialout the getty on the dialin device is kind of
  47.   frozen until the dialout has finished. Therefore, the dialin
  48.   structure isn't really interesting while a dialout is in progress.
  49.  
  50.   So I merged both tty structures to one line on the display. If
  51.   the dialout device is used, its tty structure is displayed
  52.   (as the dialin device can't do much at this time), and if a
  53.   dialin is in progress, or the device is at least waiting for
  54.   a dialin, the dialin tty structure is displayed. Now one
  55.   can have all of the 16 possible FAS ports on one screen. :-)
  56.   The distinction between the devices is possible because the
  57.   respective device names are displayed.
  58.  
  59. - You apparently decided for u386mon that the tty timeout
  60.   flag is displayed as a `T' (according to the tty flag legend
  61.   at the bottom on the screen. However, in the code that displays
  62.   the flags there was still a `D' character used. For the sake
  63.   of consistency I made changes so that in u386mon and also
  64.   in siomon and uusnap this flag is represented by a `T'.
  65.  
  66. - The area between the last tty line and the legend on the
  67.   sio screen wasn't erased properly. Apparently, this was
  68.   a typo.
  69.  
  70. - The incrementation of the pointer `call' in `det_table.c'
  71.   was done before `call' was used. The incrementation should
  72.   happen after the pointer was used.
  73.  
  74. - I left in the diffs to `siotools/Makefile' so that you can
  75.   see which flags and libs I've used for ISC UNIX (actually,
  76.   I use ISC UNIX 3.0, but I still have the developement package
  77.   for 2.21 installed, so I'd say these flags are for version
  78.   2.21). siomon and uusnap should work with both SCO and ISC
  79.   UNIX. I couldn't check other flavours. For ISC UNIX, I didn't
  80.   need to worry about `-lx' because this lib doesn't contain
  81.   opendir() etc. So it is save to put it before `-lc_s'.
  82.  
  83. - This `a.kludge.did.not.work' kludge in `siotools/kmemsio.c' did
  84.   indeed not work for ISC UNIX. I couldn't figure out what this
  85.   kludge was supposed to do, so I removed it, and I think that
  86.   it should still work with SCO UNIX.
  87.  
  88. - `typeahead(-1)' is used now unconditionally in uusnap and siomon
  89.   because it is used unconditionally in u386mon as well. So one
  90.   can assume that all UNIX flavours have this function. I had
  91.   some problems with entering commands in siomon and uusnap
  92.   until I included this function call. Also, I changed the
  93.   soures to always use getch() or wgetch(). Originally, read()
  94.   was used at some places, while getch() was used at other
  95.   places. I think that it isn't a good idea to mix read() and
  96.   getch() in the same sources. So I fixed this, and everything
  97.   works as expected.
  98.  
  99. - In uusnap there was a problem with the UUCP lock files. The
  100.   original directory for lock files in HDB UUCP is `/usr/spool/locks'.
  101.   Only SCO changed this to `/usr/spool/uucp', probably for Xenix
  102.   compatibility. So I made this portable and changed some variable
  103.   and function names to make it more clear that they deal with
  104.   lock files. Now SCO gets `/usr/spool/uucp' and all other UNIX
  105.   flavours use `/usr/spool/locks'.
  106.  
  107. - I ran an earlier version of uusnap for some years, and I found
  108.   it rather comfortable that the date _and_ the time were displayed.
  109.   So if a site didn't poll for a few days and there was a date instead
  110.   of a time in the LAST and NEXT columns, I just had to look at the
  111.   current date in the upper right corner and knew for how many days
  112.   the respective site didn't call. With the new version I always
  113.   have to take a look onto my watch because I usually don't know
  114.   the exact date without checking. Therefore, I put the code for
  115.   the date back into display_tod().
  116.  
  117. - Fixed one occurence where nap() was used even if HAVE_SELECT
  118.   was defined.
  119.  
  120. - Although all UNIX flavours appear to have the bootinfo structure,
  121.   the structure members `bootstr' and `bootstrlen' seem to be
  122.   unique to SCO UNIX. Therefore, only SCO UNIX has the bootinfo
  123.   screen selected by `b' (in u386mon).
  124.  
  125. Hope you like the patches. If you need a beta tester for the next
  126. version I'd be willing to try out the sources on my system.
  127.  
  128.       Uwe
  129.  
  130. Yes, Uwe, I do -- and so will the rest of us.
  131.  
  132.  
  133. diff -c -r ../u386mon.orig/config.h ./config.h
  134. *** ../u386mon.orig/config.h    Fri Nov 27 15:34:25 1992
  135. --- ./config.h    Fri Nov 27 15:37:24 1992
  136. ***************
  137. *** 111,117 ****
  138.   #define DPT_PS        1
  139.   #define DPT_PS_LONG    2
  140.   #define DPT_EXTRA    3
  141. ! #ifdef M_UNIX
  142.   #define DPT_SIO        4
  143.   #endif
  144.   #if defined(M_UNIX) || defined(SVR31) || defined(ISC22)
  145. --- 111,117 ----
  146.   #define DPT_PS        1
  147.   #define DPT_PS_LONG    2
  148.   #define DPT_EXTRA    3
  149. ! #if defined(M_UNIX) || defined(SIO_IS_FAS)
  150.   #define DPT_SIO        4
  151.   #endif
  152.   #if defined(M_UNIX) || defined(SVR31) || defined(ISC22)
  153. diff -c -r ../u386mon.orig/det_sio.c ./det_sio.c
  154. *** ../u386mon.orig/det_sio.c    Fri Nov 27 15:34:20 1992
  155. --- ./det_sio.c    Wed Nov 25 15:32:15 1992
  156. ***************
  157. *** 228,234 ****
  158. --- 228,248 ----
  159.   struct tty *sio1;
  160.   struct tty *sio2;
  161.   {
  162. + #if defined(SIO_IS_FAS)
  163. +     register slot1;
  164. +     register slot2;
  165. +     slot1 = sio1->t_slot;
  166. +     slot2 = sio2->t_slot;
  167. +     if(slot1 < SIO_NTTY)
  168. +         slot1 %= SIO_NTTY / 2;
  169. +     if(slot2 < SIO_NTTY)
  170. +         slot2 %= SIO_NTTY / 2;
  171. +     return(slot1 - slot2);
  172. + #else
  173.       return(sio1->t_slot - sio2->t_slot);
  174. + #endif
  175.   }    /* end of tty_slot_compare */
  176.   
  177.   /*+-------------------------------------------------------------------------
  178. ***************
  179. *** 238,250 ****
  180.   grok_sio_tty()
  181.   {
  182.       register isio;
  183. -     register struct tty *tsio;
  184.   
  185.       nsio = 0;
  186.       kread((caddr_t)sio,sio_ttyaddr,sizeof(struct tty) * SIO_NTTY);
  187.       for(isio = 0; isio < SIO_NTTY; isio++)
  188.       {
  189. !         tsio = &sio[isio];
  190.           if(tsio->t_state & (WOPEN | ISOPEN))
  191.           {
  192.               tsio->t_slot = (ushort)isio;
  193. --- 252,286 ----
  194.   grok_sio_tty()
  195.   {
  196.       register isio;
  197.   
  198.       nsio = 0;
  199.       kread((caddr_t)sio,sio_ttyaddr,sizeof(struct tty) * SIO_NTTY);
  200. + #if defined(SIO_IS_FAS)
  201. +     for(isio = 0; isio < (SIO_NTTY / 2); isio++)
  202. +     {
  203. +         if(sio[isio].t_state & ISOPEN)
  204. +         {
  205. +             sio[isio].t_slot = (ushort)isio;
  206. +             sio[isio + (SIO_NTTY / 2)].t_slot = 127;
  207. +             nsio++;
  208. +             continue;
  209. +         }
  210. +         else if(sio[isio + (SIO_NTTY / 2)].t_state & (WOPEN | ISOPEN))
  211. +         {
  212. +             sio[isio + (SIO_NTTY / 2)].t_slot
  213. +                 = (ushort)(isio + (SIO_NTTY / 2));
  214. +             sio[isio].t_slot = 127;
  215. +             nsio++;
  216. +             continue;
  217. +         }
  218. +         sio[isio].t_slot = 127;
  219. +         sio[isio + (SIO_NTTY / 2)].t_slot = 127;
  220. +     }
  221. + #else
  222.       for(isio = 0; isio < SIO_NTTY; isio++)
  223.       {
  224. !         register struct tty *tsio = &sio[isio];
  225.           if(tsio->t_state & (WOPEN | ISOPEN))
  226.           {
  227.               tsio->t_slot = (ushort)isio;
  228. ***************
  229. *** 253,258 ****
  230. --- 289,295 ----
  231.           }
  232.           tsio->t_slot = 127;
  233.       }
  234. + #endif
  235.       (void)qsort((char *)sio,(unsigned)SIO_NTTY,
  236.           sizeof(struct tty),tty_slot_compare);
  237.   
  238. ***************
  239. *** 430,436 ****
  240.   
  241.       wmove(win,y,TX);
  242.       if(ttynm = slot_to_ttynm(tsio->t_slot))
  243. !         wprintw(win,"%.2s",ttynm);
  244.       else
  245.           wprintw(win,"%02d",tsio->t_slot);
  246.   
  247. --- 467,473 ----
  248.   
  249.       wmove(win,y,TX);
  250.       if(ttynm = slot_to_ttynm(tsio->t_slot))
  251. !         wprintw(win,"%-4.4s",ttynm);
  252.       else
  253.           wprintw(win,"%02d",tsio->t_slot);
  254.   
  255. ***************
  256. *** 491,497 ****
  257.       if(tsio->t_state & TTSTOP)
  258.           s8[3] = 'S';
  259.       if(tsio->t_state & TIMEOUT)
  260. !         s8[4] = 'D';
  261.       wmove(win,y,FX);
  262.       waddstr(win,s8);
  263.   
  264. --- 528,534 ----
  265.       if(tsio->t_state & TTSTOP)
  266.           s8[3] = 'S';
  267.       if(tsio->t_state & TIMEOUT)
  268. !         s8[4] = 'T';
  269.       wmove(win,y,FX);
  270.       waddstr(win,s8);
  271.   
  272. ***************
  273. *** 519,525 ****
  274.       static char *header  = 
  275.       " tty  raw  can    out  speed  state  iflag  oflag  cflag  lflag  pgrp";
  276.       static char *legend =
  277. !     "W=wait for open  O=open C=carrier on  B=output busy  S=stopped  T=timeout";
  278.       static int couldnt_display_all = 0;
  279.   
  280.       if(initial)
  281. --- 556,562 ----
  282.       static char *header  = 
  283.       " tty  raw  can    out  speed  state  iflag  oflag  cflag  lflag  pgrp";
  284.       static char *legend =
  285. !     "W=wait for open  O=open  C=carrier on  B=output busy  S=stopped  T=timeout";
  286.       static int couldnt_display_all = 0;
  287.   
  288.       if(initial)
  289. ***************
  290. *** 557,564 ****
  291.           display_siosum_update(win,isio + 1,&sio[isio]);
  292.       }
  293.   
  294. !     for(; isio < getmaxy(win)-2; isio++);
  295. !     clear_area(win,isio + 1,0,getmaxx(win));
  296.   
  297.       if(couldnt_display_all)
  298.       {
  299. --- 594,601 ----
  300.           display_siosum_update(win,isio + 1,&sio[isio]);
  301.       }
  302.   
  303. !     for(; isio < getmaxy(win)-2; isio++)
  304. !         clear_area(win,isio + 1,0,getmaxx(win));
  305.   
  306.       if(couldnt_display_all)
  307.       {
  308. diff -c -r ../u386mon.orig/det_table.c ./det_table.c
  309. *** ../u386mon.orig/det_table.c    Fri Nov 27 15:34:21 1992
  310. --- ./det_table.c    Wed Nov 25 14:51:24 1992
  311. ***************
  312. *** 166,174 ****
  313.       kread((caddr_t) callbase, calloutaddr, sizeof(struct callo)*v.v_call);
  314.       call=callbase;
  315.       while (ndx<v.v_call) {
  316. -         ndx++; call++;
  317.                   /* This is a guess - I'm checking it with SCO */
  318.           if (call->c_id>0) cnt++;
  319.       }
  320.       return(cnt);
  321.   }
  322. --- 166,174 ----
  323.       kread((caddr_t) callbase, calloutaddr, sizeof(struct callo)*v.v_call);
  324.       call=callbase;
  325.       while (ndx<v.v_call) {
  326.                   /* This is a guess - I'm checking it with SCO */
  327.           if (call->c_id>0) cnt++;
  328. +         ndx++; call++;
  329.       }
  330.       return(cnt);
  331.   }
  332. diff -c -r ../u386mon.orig/siotools/Makefile ./siotools/Makefile
  333. *** ../u386mon.orig/siotools/Makefile    Fri Nov 27 15:34:30 1992
  334. --- ./siotools/Makefile    Fri Nov 27 15:41:41 1992
  335. ***************
  336. *** 16,27 ****
  337.   #               this makes for long druding nlists
  338.   # -DSIO_IS_FAS: is how I get the stuff to work with my FAS configuration
  339.   #               study the code, especially ../ttynm.h
  340. ! CFLAGS2 = -DSIO_IS_FAS
  341.   
  342.   # SCO CC
  343.   CC=cc
  344.   CFLAGS = \
  345. !     -O \
  346.       $(CFLAGS2)
  347.   
  348.   # SCO UNIX 3.2->3.2v4 gcc
  349. --- 16,27 ----
  350.   #               this makes for long druding nlists
  351.   # -DSIO_IS_FAS: is how I get the stuff to work with my FAS configuration
  352.   #               study the code, especially ../ttynm.h
  353. ! CFLAGS2 = -DSIO_IS_FAS -DHAVE_SELECT -DISC
  354.   
  355.   # SCO CC
  356.   CC=cc
  357.   CFLAGS = \
  358. !     -O -s \
  359.       $(CFLAGS2)
  360.   
  361.   # SCO UNIX 3.2->3.2v4 gcc
  362. ***************
  363. *** 41,50 ****
  364.   
  365.   # get shared library stuff first, then opendir/etc from libc.a not libx.a
  366.   # then get nap/rdchk from libx.a
  367. ! LIB=-ltinfo -lc_s -lc -lx
  368.   
  369.   # local bin directory (for make install)
  370. ! LBIN=/usr/local/bin
  371.   
  372.   SIOMON_OBJ = \
  373.       siomon.o\
  374. --- 41,50 ----
  375.   
  376.   # get shared library stuff first, then opendir/etc from libc.a not libx.a
  377.   # then get nap/rdchk from libx.a
  378. ! LIB=-lcurses -linet -lx -lc_s
  379.   
  380.   # local bin directory (for make install)
  381. ! LBIN=/usr/lbin
  382.   
  383.   SIOMON_OBJ = \
  384.       siomon.o\
  385. diff -c -r ../u386mon.orig/siotools/kmemsio.c ./siotools/kmemsio.c
  386. *** ../u386mon.orig/siotools/kmemsio.c    Fri Nov 27 15:34:31 1992
  387. --- ./siotools/kmemsio.c    Fri Nov 27 14:49:01 1992
  388. ***************
  389. *** 20,26 ****
  390.   
  391.   #include "kmemsio.h"
  392.   
  393. ! #ifdef M_UNIX
  394.   char *kernel_file = "/unix";
  395.   
  396.   #include <nlist.h>
  397. --- 20,26 ----
  398.   
  399.   #include "kmemsio.h"
  400.   
  401. ! #if defined(M_UNIX) || defined(ISC)
  402.   char *kernel_file = "/unix";
  403.   
  404.   #include <nlist.h>
  405. ***************
  406. *** 59,67 ****
  407.   #else  /* !STANDALONE_NLIST */
  408.   #undef M_TERMINFO
  409.   #include "../config.h"
  410. - #ifndef M_TERMINFO
  411. - a.kludge.did.not.work;
  412. - #endif
  413.   #include "../nlsym.h"
  414.   #include "../libnlsym.h"
  415.   #endif /* STANDALONE_NLIST */
  416. --- 59,64 ----
  417. diff -c -r ../u386mon.orig/siotools/siomon.c ./siotools/siomon.c
  418. *** ../u386mon.orig/siotools/siomon.c    Fri Nov 27 15:34:31 1992
  419. --- ./siotools/siomon.c    Fri Nov 27 15:07:56 1992
  420. ***************
  421. *** 30,36 ****
  422.   19  2h
  423.   20 
  424.   21 State: W waiting for open to complete  O open  C carrier on
  425. ! 22        S stopped by XOFF  D interval timeout in progress
  426.   23 Commands: + inc interval  - dec interval  ^L refresh  q quit  d detail
  427.   
  428.   Under XENIX, termio.h is included twice (once by curses.h/tcap.h and
  429. --- 30,36 ----
  430.   19  2h
  431.   20 
  432.   21 State: W waiting for open to complete  O open  C carrier on
  433. ! 22        S stopped by XOFF  T interval timeout in progress
  434.   23 Commands: + inc interval  - dec interval  ^L refresh  q quit  d detail
  435.   
  436.   Under XENIX, termio.h is included twice (once by curses.h/tcap.h and
  437. ***************
  438. *** 90,97 ****
  439. --- 90,101 ----
  440.   #include <time.h>
  441.   
  442.   #if defined(HAVE_SELECT)
  443. + #if defined(ISC)
  444. + #include <sys/bsdtypes.h>
  445. + #else
  446.   #include <sys/select.h>
  447.   #endif
  448. + #endif
  449.   
  450.   #include <sys/tty.h>
  451.   
  452. ***************
  453. *** 161,167 ****
  454.       char s8[8];
  455.   
  456.       move(y,TX + 0);
  457. !     addstr(ttynm[sionum]);
  458.   
  459.       if(!opened)
  460.       {
  461. --- 165,171 ----
  462.       char s8[8];
  463.   
  464.       move(y,TX + 0);
  465. !     printw("%-4.4s",ttynm[sionum]);
  466.   
  467.       if(!opened)
  468.       {
  469. ***************
  470. *** 206,212 ****
  471.       if(tty->t_state & TTSTOP)
  472.           s8[3] = 'S';
  473.       if(tty->t_state & TIMEOUT)
  474. !         s8[4] = 'D';
  475.       move(y,FX);
  476.       addstr(s8);
  477.   
  478. --- 210,216 ----
  479.       if(tty->t_state & TTSTOP)
  480.           s8[3] = 'S';
  481.       if(tty->t_state & TIMEOUT)
  482. !         s8[4] = 'T';
  483.       move(y,FX);
  484.       addstr(s8);
  485.   
  486. ***************
  487. *** 253,259 ****
  488.   "State: W waiting for open to complete  O open  C carrier on");
  489.       move(LINES - 3,0);
  490.       addstr(
  491. ! "       S stopped by XOFF  D interval timeout in progress  B transmitter busy");
  492.   }    /* end of disp_state_legend */
  493.   
  494.   /*+-------------------------------------------------------------------------
  495. --- 257,263 ----
  496.   "State: W waiting for open to complete  O open  C carrier on");
  497.       move(LINES - 3,0);
  498.       addstr(
  499. ! "       S stopped by XOFF  T interval timeout in progress  B transmitter busy");
  500.   }    /* end of disp_state_legend */
  501.   
  502.   /*+-------------------------------------------------------------------------
  503. ***************
  504. *** 343,349 ****
  505.       standout();
  506.       printw(" siomon %s (%s V.%s/%s)",
  507.           revision,
  508. ! #if defined(M_UNIX)
  509.           "UNIX",
  510.   #else
  511.           "XENIX",
  512. --- 347,353 ----
  513.       standout();
  514.       printw(" siomon %s (%s V.%s/%s)",
  515.           revision,
  516. ! #if defined(M_UNIX) || defined(ISC)
  517.           "UNIX",
  518.   #else
  519.           "XENIX",
  520. ***************
  521. *** 444,458 ****
  522.       long nap();
  523.   #endif
  524.   
  525. -     for(y = 0; y < (LINES - 4); y++)
  526. -     {
  527. -         move(HY + 2 + y,0);
  528. -         clrtoeol();
  529. -     }
  530.       disp_cmd_legend("display detail on /dev/tty");
  531.       getyx(stdscr,y,x);
  532.   
  533. !     if(wingets(stdscr,y,x,tty_name,3,&delim,0,(int *)0) < 0)
  534.           return;
  535.       for(sionum = 0,cpptr = ttynm; sionum < SIO_NTTY; sionum++,cpptr++)
  536.       {
  537. --- 448,457 ----
  538.       long nap();
  539.   #endif
  540.   
  541.       disp_cmd_legend("display detail on /dev/tty");
  542.       getyx(stdscr,y,x);
  543.   
  544. !     if(wingets(stdscr,y,x,tty_name,5,&delim,0,(int *)0) < 0)
  545.           return;
  546.       for(sionum = 0,cpptr = ttynm; sionum < SIO_NTTY; sionum++,cpptr++)
  547.       {
  548. ***************
  549. *** 465,470 ****
  550. --- 464,474 ----
  551.           return;
  552.       }
  553.   
  554. +     for(y = 0; y < (LINES - 4); y++)
  555. +     {
  556. +         move(HY + 2 + y,0);
  557. +         clrtoeol();
  558. +     }
  559.       disp_state_legend();
  560.       disp_cmd_legend("");
  561.       move(LINES - 2,0);
  562. ***************
  563. *** 573,582 ****
  564.           fputs("curses init failed ... check terminal type\n",stderr);
  565.           exit(1);
  566.       }
  567. - #if defined(M_TERMINFO)
  568.       typeahead(-1);
  569. ! #endif
  570. !     crmode();
  571.       noecho();
  572.       main_template();
  573.   
  574. --- 577,584 ----
  575.           fputs("curses init failed ... check terminal type\n",stderr);
  576.           exit(1);
  577.       }
  578.       typeahead(-1);
  579. !     cbreak();
  580.       noecho();
  581.       main_template();
  582.   
  583. ***************
  584. *** 602,607 ****
  585. --- 604,627 ----
  586.       while(1)
  587.       {
  588.           kmem_read_tty(0,SIO_NTTY);
  589. + #if defined(SIO_IS_FAS)
  590. +         for(sionum = 0; sionum < (SIO_NTTY / 2); sionum++)
  591. +         {
  592. +             int yy = HY + 2 + sionum;
  593. +             if(yy == (LINES - 5))
  594. +             {
  595. +                 move(yy,0);
  596. +                 clrtoeol();
  597. +                 addstr("not enough room for all ttys");
  598. +                 break;
  599. +             }
  600. +             if (sio[sionum].t_state & ISOPEN)
  601. +                 disp_tty(yy,sionum,&sio[sionum]);
  602. +             else
  603. +                 disp_tty(yy,sionum + (SIO_NTTY / 2),
  604. +                         &sio[sionum + (SIO_NTTY / 2)]);
  605. +         }
  606. + #else
  607.           for(sionum = 0; sionum < SIO_NTTY; sionum++)
  608.           {
  609.               int yy = HY + 2 + sionum;
  610. ***************
  611. *** 614,619 ****
  612. --- 634,640 ----
  613.               }
  614.               disp_tty(yy,sionum,&sio[sionum]);
  615.           }
  616. + #endif
  617.           disp_tod();
  618.           move(LINES - 1,0);
  619.           refresh();
  620. ***************
  621. *** 636,643 ****
  622.           if(cmd_available)
  623.           {
  624.           char ch;
  625. !             ch = getch();
  626. !             switch(ch & 0x7F)
  627.               {
  628.               case 'L' & 0x1F:        /* redraw screen */
  629.               case 'R' & 0x1F:        /* redraw screen */
  630. --- 657,664 ----
  631.           if(cmd_available)
  632.           {
  633.           char ch;
  634. !             ch = getch() & 0x7F;
  635. !             switch(ch)
  636.               {
  637.               case 'L' & 0x1F:        /* redraw screen */
  638.               case 'R' & 0x1F:        /* redraw screen */
  639. diff -c -r ../u386mon.orig/siotools/uusnap.c ./siotools/uusnap.c
  640. *** ../u386mon.orig/siotools/uusnap.c    Fri Nov 27 15:34:33 1992
  641. --- ./siotools/uusnap.c    Fri Nov 27 15:52:06 1992
  642. ***************
  643. *** 20,26 ****
  644.       main(argc,argv)
  645.       my_resetty()
  646.       my_savetty()
  647. !     spooldirname(fname)
  648.       statdirname(fname)
  649.       strcmpi(s1,s2)
  650.       to_lower(ch)
  651. --- 20,26 ----
  652.       main(argc,argv)
  653.       my_resetty()
  654.       my_savetty()
  655. !     lockdirname(fname)
  656.       statdirname(fname)
  657.       strcmpi(s1,s2)
  658.       to_lower(ch)
  659. ***************
  660. *** 76,86 ****
  661. --- 76,92 ----
  662.   #include <sys/stat.h>
  663.   #include <sys/tty.h>
  664.   #include <sys/utsname.h>
  665. + #if defined(HAVE_SELECT)
  666.   #if defined(M_SYSV)
  667.   #include <sys/select.h>
  668.   #else
  669. + #if defined(ISC)
  670. + #include <sys/bsdtypes.h>
  671. + #else
  672.   #include <sys/time.h>
  673.   #endif
  674. + #endif
  675. + #endif
  676.   
  677.   #include "wintty.h"
  678.   #define DEFINE_TTYNM
  679. ***************
  680. *** 122,130 ****
  681.   char bell = 7;
  682.   
  683.   char *STATUSDIR = "/usr/spool/uucp/.Status";
  684. ! char *LOCKDIR = "/usr/spool/uucp/LCK..";
  685.   char *WORKDIR = "/usr/spool/uucp/";
  686. - char *SPOOLDIR = "/usr/spool/uucp";
  687.   
  688.   #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 4)
  689.   #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
  690. --- 128,139 ----
  691.   char bell = 7;
  692.   
  693.   char *STATUSDIR = "/usr/spool/uucp/.Status";
  694. ! #if defined(ISC)
  695. ! char *LOCKDIR = "/usr/spool/locks";
  696. ! #else
  697. ! char *LOCKDIR = "/usr/spool/uucp";
  698. ! #endif
  699.   char *WORKDIR = "/usr/spool/uucp/";
  700.   
  701.   #define MAX_SYSTEMS (LINES - FIRSTSYS_Y - 4)
  702.   #define WAITSECS_ACTIVE 1 /* sleep secs between samples when talking */
  703. ***************
  704. *** 152,158 ****
  705.   #define SS_UNKNOWN_RESPONSE      19    /* remote reject, unknown msg */
  706.   #define SS_STARTUP               20    /* startup failed */
  707.   #define SS_CHAT_FAILED           21    /* caller script failed */
  708. ! #if defined(M_SYSV)
  709.   #define SS_CALL_IN_PROGRESS         22    /* CALL IN PROGRESS */
  710.   #define SS_CALL_FAILED           23    /* call failed (busy?) */
  711.   #else
  712. --- 161,167 ----
  713.   #define SS_UNKNOWN_RESPONSE      19    /* remote reject, unknown msg */
  714.   #define SS_STARTUP               20    /* startup failed */
  715.   #define SS_CHAT_FAILED           21    /* caller script failed */
  716. ! #if defined(M_SYSV) || defined(ISC)
  717.   #define SS_CALL_IN_PROGRESS         22    /* CALL IN PROGRESS */
  718.   #define SS_CALL_FAILED           23    /* call failed (busy?) */
  719.   #else
  720. ***************
  721. *** 187,193 ****
  722.       /* 19*/ "remote reject, unknown msg",
  723.       /* 20*/ "startup failed",
  724.       /* 21*/ "caller script failed",
  725. ! #if defined(SYSV)
  726.       /* 22*/ "CALL IN PROGRESS",
  727.       /* 23*/ "call failed (busy?)",
  728.   #else
  729. --- 196,202 ----
  730.       /* 19*/ "remote reject, unknown msg",
  731.       /* 20*/ "startup failed",
  732.       /* 21*/ "caller script failed",
  733. ! #if defined(M_SYSV) || defined(ISC)
  734.       /* 22*/ "CALL IN PROGRESS",
  735.       /* 23*/ "call failed (busy?)",
  736.   #else
  737. ***************
  738. *** 195,201 ****
  739.   #endif
  740.   };
  741.   
  742. ! #if defined(SYSV)
  743.   #define SS_MSG_MAX 23
  744.   #else
  745.   #define SS_MSG_MAX 22
  746. --- 204,210 ----
  747.   #endif
  748.   };
  749.   
  750. ! #if defined(M_SYSV) || defined(ISC)
  751.   #define SS_MSG_MAX 23
  752.   #else
  753.   #define SS_MSG_MAX 22
  754. ***************
  755. *** 295,306 ****
  756.   }    /* end of statdirname */
  757.   
  758.   /*+-------------------------------------------------------------------------
  759. !     spooldirname(fname) - return base name prepended with spool dir
  760.   
  761.   returns address of static string
  762.   --------------------------------------------------------------------------*/
  763.   char *
  764. ! spooldirname(fname)
  765.   char *fname;
  766.   {
  767.       static char fullname[128];
  768. --- 304,315 ----
  769.   }    /* end of statdirname */
  770.   
  771.   /*+-------------------------------------------------------------------------
  772. !     lockdirname(fname) - return base name prepended with lock dir
  773.   
  774.   returns address of static string
  775.   --------------------------------------------------------------------------*/
  776.   char *
  777. ! lockdirname(fname)
  778.   char *fname;
  779.   {
  780.       static char fullname[128];
  781. ***************
  782. *** 308,314 ****
  783.   
  784.       if(!fullname_cat_point)
  785.       {
  786. !         strcpy(fullname,SPOOLDIR);
  787.           strcat(fullname,"/");
  788.           fullname_cat_point = strlen(fullname);
  789.       }
  790. --- 317,323 ----
  791.   
  792.       if(!fullname_cat_point)
  793.       {
  794. !         strcpy(fullname,LOCKDIR);
  795.           strcat(fullname,"/");
  796.           fullname_cat_point = strlen(fullname);
  797.       }
  798. ***************
  799. *** 316,322 ****
  800.       strcpy(fullname + fullname_cat_point,fname);
  801.       return(fullname);
  802.   
  803. ! }    /* end of statdirname */
  804.   
  805.   /*+-------------------------------------------------------------------------
  806.       display_tod()
  807. --- 325,331 ----
  808.       strcpy(fullname + fullname_cat_point,fname);
  809.       return(fullname);
  810.   
  811. ! }    /* end of lockdirname */
  812.   
  813.   /*+-------------------------------------------------------------------------
  814.       display_tod()
  815. ***************
  816. *** 326,332 ****
  817.   {
  818.       register struct tm *lt;        /* local time */
  819.       struct tm *localtime();
  820. !     char buf[10];
  821.   
  822.       (void)time(&secs_now);
  823.   
  824. --- 335,341 ----
  825.   {
  826.       register struct tm *lt;        /* local time */
  827.       struct tm *localtime();
  828. !     char buf[20];
  829.   
  830.       (void)time(&secs_now);
  831.   
  832. ***************
  833. *** 334,345 ****
  834.           return;
  835.   
  836.       lt = localtime(&secs_now);
  837. !     utoda_lz(buf,2,lt->tm_hour);
  838. !     buf[2] = ':';
  839. !     utoda_lz(buf + 3,2,lt->tm_min);
  840. !     buf[5] = ':';
  841. !     utoda_lz(buf + 6,2,lt->tm_sec);
  842. !     move(0,COLS - 18);
  843.       addstr(buf);
  844.   
  845.   }    /* end of display_tod */
  846. --- 343,360 ----
  847.           return;
  848.   
  849.       lt = localtime(&secs_now);
  850. !     utoda_lz(buf,2,lt->tm_mon + 1);
  851. !     buf[2] = '/';
  852. !     utoda_lz(buf + 3,2,lt->tm_mday);
  853. !     buf[5] = '/';
  854. !     utoda_lz(buf + 6,2,lt->tm_year);
  855. !     buf[8] = ' ';
  856. !     utoda_lz(buf + 9,2,lt->tm_hour);
  857. !     buf[11] = ':';
  858. !     utoda_lz(buf + 12,2,lt->tm_min);
  859. !     buf[14] = ':';
  860. !     utoda_lz(buf + 15,2,lt->tm_sec);
  861. !     move(0,COLS - 26);
  862.       addstr(buf);
  863.   
  864.   }    /* end of display_tod */
  865. ***************
  866. *** 358,364 ****
  867.           clrtobot();
  868.           refresh();
  869.           echo();
  870. !         nocrmode();
  871.           move(LINES - 1,0);
  872.           refresh();
  873.           my_resetty();
  874. --- 373,379 ----
  875.           clrtobot();
  876.           refresh();
  877.           echo();
  878. !         nocbreak();
  879.           move(LINES - 1,0);
  880.           refresh();
  881.           my_resetty();
  882. ***************
  883. *** 383,389 ****
  884.       {
  885.           if(strncmp(dp->d_name,"LCK..tty",8))
  886.               continue;
  887. !         if(fp = fopen(spooldirname(dp->d_name),"r"))
  888.           {
  889.               fscanf(fp,"%d",&testpid);
  890.               fclose(fp);
  891. --- 398,404 ----
  892.       {
  893.           if(strncmp(dp->d_name,"LCK..tty",8))
  894.               continue;
  895. !         if(fp = fopen(lockdirname(dp->d_name),"r"))
  896.           {
  897.               fscanf(fp,"%d",&testpid);
  898.               fclose(fp);
  899. ***************
  900. *** 522,528 ****
  901.       }
  902.   
  903.       /* "kludges for screwy status stuff with HDB" thanks to Ed Carp */
  904. !     strcpy(lock_name,LOCKDIR);
  905.       strcat(lock_name,system_name);
  906.       if(!access(lock_name,0) && (status != SS_TALKING))
  907.           status = SS_CALL_IN_PROGRESS;
  908. --- 537,543 ----
  909.       }
  910.   
  911.       /* "kludges for screwy status stuff with HDB" thanks to Ed Carp */
  912. !     strcpy(lock_name,lockdirname("LCK.."));
  913.       strcat(lock_name,system_name);
  914.       if(!access(lock_name,0) && (status != SS_TALKING))
  915.           status = SS_CALL_IN_PROGRESS;
  916. ***************
  917. *** 665,671 ****
  918.       clrtoeol();
  919.       getyx(stdscr,y,x);
  920.       move(y,TX + x);
  921. !     addstr(ttynm[sionum]);
  922.       if((itmp = (unsigned)tty->t_rawq.c_cc) > 999)
  923.           itmp = 999;
  924.       utoda(s8,3,itmp);
  925. --- 680,686 ----
  926.       clrtoeol();
  927.       getyx(stdscr,y,x);
  928.       move(y,TX + x);
  929. !     printw("%-4.4s",ttynm[sionum]);
  930.       if((itmp = (unsigned)tty->t_rawq.c_cc) > 999)
  931.           itmp = 999;
  932.       utoda(s8,3,itmp);
  933. ***************
  934. *** 703,709 ****
  935.       if(tty->t_state & TTSTOP)
  936.           s8[3] = 'S';
  937.       if(tty->t_state & TIMEOUT)
  938. !         s8[3] = 'D';
  939.       move(y,FX + x);
  940.       addstr(s8);
  941.   
  942. --- 718,724 ----
  943.       if(tty->t_state & TTSTOP)
  944.           s8[3] = 'S';
  945.       if(tty->t_state & TIMEOUT)
  946. !         s8[3] = 'T';
  947.       move(y,FX + x);
  948.       addstr(s8);
  949.   
  950. ***************
  951. *** 790,795 ****
  952. --- 805,814 ----
  953.       char **cpptr;
  954.       char delim;
  955.       char s8[8];
  956. + #if defined(HAVE_SELECT)
  957. +     struct timeval timeout;
  958. +     int fdmask;
  959. + #endif
  960.   
  961.       static char *header  =
  962.       "tty  raw  can   out   speed  state iflag  oflag  cflag  lflag  pgrp";
  963. ***************
  964. *** 800,806 ****
  965.       static char *state1 =
  966.       "State: W waiting for open to complete  O open  C carrier on";
  967.       static char *state2 =
  968. !     "       S stopped by XOFF  D delay timeout in progress  B transmitter busy";
  969.       static kmem_initialized = 0;
  970.   
  971.       disp_cmd_legend("display detail on system # (ESC to cancel): ");
  972. --- 819,825 ----
  973.       static char *state1 =
  974.       "State: W waiting for open to complete  O open  C carrier on";
  975.       static char *state2 =
  976. !     "       S stopped by XOFF  T delay timeout in progress  B transmitter busy";
  977.       static kmem_initialized = 0;
  978.   
  979.       disp_cmd_legend("display detail on system # (ESC to cancel): ");
  980. ***************
  981. *** 873,879 ****
  982.           
  983.               if(cptr = kmem_read_tty(ttnum,1))
  984.               {
  985. ! #ifdef SIO_IS_FAS
  986.   BAD_NEWS:
  987.   #endif
  988.                   standout();
  989. --- 892,898 ----
  990.           
  991.               if(cptr = kmem_read_tty(ttnum,1))
  992.               {
  993. ! #if defined(SIO_IS_FAS) && !defined(ISC)
  994.   BAD_NEWS:
  995.   #endif
  996.                   standout();
  997. ***************
  998. *** 885,891 ****
  999.                   getch();
  1000.                   goto DETAIL_EXIT;
  1001.               }
  1002. ! #ifdef SIO_IS_FAS
  1003.               if(!(sio[0].t_state & (WOPEN | ISOPEN)))
  1004.               {
  1005.                   char other_tty[64];
  1006. --- 904,910 ----
  1007.                   getch();
  1008.                   goto DETAIL_EXIT;
  1009.               }
  1010. ! #if defined(SIO_IS_FAS) && !defined(ISC)
  1011.               if(!(sio[0].t_state & (WOPEN | ISOPEN)))
  1012.               {
  1013.                   char other_tty[64];
  1014. ***************
  1015. *** 908,914 ****
  1016.                   if(cptr = kmem_read_tty(ttnum,1))
  1017.                       goto BAD_NEWS;
  1018.               }
  1019. ! #endif /* SIO_IS_FAS */
  1020.               if(!have_tty)
  1021.               {
  1022.                   move(y+3,0);
  1023. --- 927,933 ----
  1024.                   if(cptr = kmem_read_tty(ttnum,1))
  1025.                       goto BAD_NEWS;
  1026.               }
  1027. ! #endif /* SIO_IS_FAS && !ISC */
  1028.               if(!have_tty)
  1029.               {
  1030.                   move(y+3,0);
  1031. ***************
  1032. *** 947,953 ****
  1033. --- 966,979 ----
  1034.               getch();
  1035.               break;
  1036.           }
  1037. + #if defined(HAVE_SELECT)
  1038. +         timeout.tv_sec = 0;
  1039. +         timeout.tv_usec = ((have_tty) ? 20L : 500L) * 1000L;
  1040. +         fdmask = 1 << 0;
  1041. +         select(32,&fdmask,(int *)0,(int *)0,&timeout);
  1042. + #else
  1043.           nap((have_tty) ? 20L : 500L);
  1044. + #endif
  1045.       }
  1046.   
  1047.   DETAIL_EXIT:
  1048. ***************
  1049. *** 992,1002 ****
  1050.           fprintf(stderr,"curses init failed... check terminal type\n");
  1051.           exit(0);
  1052.       }
  1053. - #if defined(M_TERMINFO)
  1054.       typeahead(-1);
  1055. - #endif
  1056.       noecho();
  1057. !     crmode();
  1058.   
  1059.       signal(SIGTERM,bye);
  1060.       signal(SIGINT,bye);
  1061. --- 1018,1026 ----
  1062.           fprintf(stderr,"curses init failed... check terminal type\n");
  1063.           exit(0);
  1064.       }
  1065.       typeahead(-1);
  1066.       noecho();
  1067. !     cbreak();
  1068.   
  1069.       signal(SIGTERM,bye);
  1070.       signal(SIGINT,bye);
  1071. ***************
  1072. *** 1009,1015 ****
  1073.       standout();
  1074.       printw(" uusnap %s (%s V.%s/%s)",
  1075.           revision,
  1076. ! #if defined(M_UNIX)
  1077.           "UNIX",
  1078.   #else
  1079.           "XENIX",
  1080. --- 1033,1039 ----
  1081.       standout();
  1082.       printw(" uusnap %s (%s V.%s/%s)",
  1083.           revision,
  1084. ! #if defined(M_UNIX) || defined(ISC)
  1085.           "UNIX",
  1086.   #else
  1087.           "XENIX",
  1088. ***************
  1089. *** 1041,1047 ****
  1090.       standend();
  1091.       refresh();
  1092.   
  1093. !     dirname = SPOOLDIR;
  1094.       if(!(uspool_dp = opendir(dirname)))
  1095.           goto BOO_HISS;
  1096.   
  1097. --- 1065,1071 ----
  1098.       standend();
  1099.       refresh();
  1100.   
  1101. !     dirname = LOCKDIR;
  1102.       if(!(uspool_dp = opendir(dirname)))
  1103.           goto BOO_HISS;
  1104.   
  1105. ***************
  1106. *** 1118,1126 ****
  1107.   
  1108.           if(rdchk(0))
  1109.           {
  1110. !             read(0,&cmd,1);
  1111. !             cmd &= 0x7f;
  1112. !             switch(cmd &= 0x7f)
  1113.               {
  1114.                   case 'q':
  1115.                   case 0x1B:
  1116. --- 1142,1149 ----
  1117.   
  1118.           if(rdchk(0))
  1119.           {
  1120. !             cmd = getch() & 0x7f;
  1121. !             switch(cmd)
  1122.               {
  1123.                   case 'q':
  1124.                   case 0x1B:
  1125. diff -c -r ../u386mon.orig/siotools/wingets.c ./siotools/wingets.c
  1126. *** ../u386mon.orig/siotools/wingets.c    Fri Nov 27 15:34:33 1992
  1127. --- ./siotools/wingets.c    Fri Nov 27 15:03:56 1992
  1128. ***************
  1129. *** 95,102 ****
  1130.       while(1)
  1131.       {
  1132.           wrefresh(win);
  1133. !         read(0,delim,1);
  1134. !         *delim &= 0x7F;
  1135.           if((*delim < 0x20) || (*delim >= 0x7F))
  1136.           {
  1137.               switch(*delim)
  1138. --- 95,101 ----
  1139.       while(1)
  1140.       {
  1141.           wrefresh(win);
  1142. !         *delim = wgetch(win) & 0x7F;
  1143.           if((*delim < 0x20) || (*delim >= 0x7F))
  1144.           {
  1145.               switch(*delim)
  1146. diff -c -r ../u386mon.orig/ttynm.h ./ttynm.h
  1147. *** ../u386mon.orig/ttynm.h    Fri Nov 27 15:34:27 1992
  1148. --- ./ttynm.h    Thu Nov 26 16:04:58 1992
  1149. ***************
  1150. *** 44,49 ****
  1151. --- 44,51 ----
  1152.    * This is the ordering of my FAS driver tty structures
  1153.    * Yours will probably be different
  1154.    */
  1155. + #if defined(M_UNIX)
  1156.   #define SIO_NTTY 18
  1157.   
  1158.   #ifdef DEFINE_TTYNM
  1159. ***************
  1160. *** 68,73 ****
  1161. --- 70,104 ----
  1162.       "2H",
  1163.   };
  1164.   #endif /* DEFINE_TTYNM */
  1165. + #else
  1166. + #define SIO_NTTY 18
  1167. + #ifdef DEFINE_TTYNM
  1168. + char *ttynm[SIO_NTTY] = {
  1169. +     "F00",
  1170. +     "F01",
  1171. +     "F02",
  1172. +     "F03",
  1173. +     "F04",
  1174. +     "F05",
  1175. +     "F06",
  1176. +     "F07",
  1177. +     "F08",
  1178. +     "FM00",
  1179. +     "FM01",
  1180. +     "FM02",
  1181. +     "FM03",
  1182. +     "FM04",
  1183. +     "FM05",
  1184. +     "FM06",
  1185. +     "FM07",
  1186. +     "FM08",
  1187. + };
  1188. + #endif /* DEFINE_TTYNM */
  1189. + #endif /* M_UNIX */
  1190.   
  1191.   #endif /* SIO_IS_FAS */
  1192.   
  1193. diff -c -r ../u386mon.orig/u386mon.c ./u386mon.c
  1194. *** ../u386mon.orig/u386mon.c    Fri Nov 27 15:34:18 1992
  1195. --- ./u386mon.c    Tue Nov 24 16:28:08 1992
  1196. ***************
  1197. *** 1418,1424 ****
  1198.                   case 'q':
  1199.                   case A_ESC:
  1200.                       goto GOOD_BYE;
  1201. ! #if defined(HAS_BOOTINFO)
  1202.                   case 'b':
  1203.                       if(bootinfo.bootstrlen > 79)
  1204.                           itmp = 79;
  1205. --- 1418,1424 ----
  1206.                   case 'q':
  1207.                   case A_ESC:
  1208.                       goto GOOD_BYE;
  1209. ! #if defined(HAS_BOOTINFO) && defined(M_UNIX)
  1210.                   case 'b':
  1211.                       if(bootinfo.bootstrlen > 79)
  1212.                           itmp = 79;
  1213. -- 
  1214. Uwe Doering  |  INET : gemini@geminix.in-berlin.de
  1215. Berlin       |----------------------------------------------------------------
  1216. Germany      |  UUCP : ...!unido!fub!geminix.in-berlin.de!gemini
  1217.  
  1218.  
  1219. exit 0 # Just in case...
  1220.