DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ s

⟦80093ab02⟧

    Length: 3688 (0xe68)
    Names: »s.mon.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec8/mon/s.mon.c« 

Hex Dump

0x000…020 01 68 36 34 30 32 38 0a 01 73 20 30 30 30 30 38 2f 30 30 30 30 30 2f 30 30 31 34 37 0a 01 64 20   ┆ h64028  s 00008/00000/00147  d ┆
0x020…040 44 20 31 2e 32 20 38 35 2f 30 31 2f 30 34 20 32 32 3a 35 36 3a 32 38 20 72 6f 6f 74 20 32 20 31   ┆D 1.2 85/01/04 22:56:28 root 2 1┆
0x040…060 0a 01 63 20 41 64 64 69 6e 67 20 75 73 65 72 20 63 6f 75 6e 74 0a 01 65 0a 01 73 20 30 30 31 34   ┆  c Adding user count  e  s 0014┆
0x060…080 37 2f 30 30 30 30 30 2f 30 30 30 30 30 0a 01 64 20 44 20 31 2e 31 20 38 35 2f 30 31 2f 30 34 20   ┆7/00000/00000  d D 1.1 85/01/04 ┆
0x080…0a0 32 32 3a 34 39 3a 32 30 20 72 6f 6f 74 20 31 20 30 0a 01 63 20 64 61 74 65 20 61 6e 64 20 74 69   ┆22:49:20 root 1 0  c date and ti┆
0x0a0…0c0 6d 65 20 63 72 65 61 74 65 64 20 38 35 2f 30 31 2f 30 34 20 32 32 3a 34 39 3a 32 30 20 62 79 20   ┆me created 85/01/04 22:49:20 by ┆
0x0c0…0e0 72 6f 6f 74 0a 01 65 0a 01 75 0a 01 55 0a 01 74 0a 01 54 0a 01 49 20 31 0a 2f 2a 0a 20 2a 09 09   ┆root  e  u  U  t  T  I 1 /*  *  ┆
0x0e0…100 09 4d 20 4f 20 4e 20 2e 20 43 0a 20 2a 0a 20 2a 20 20 41 20 70 72 6f 67 72 61 6d 20 74 6f 20 6d   ┆ M O N . C  *  *  A program to m┆
0x100…120 6f 6e 69 74 65 72 20 73 79 73 74 65 6d 20 61 63 74 69 76 69 74 79 2e 0a 20 2a 20 20 20 52 65 77   ┆oniter system activity.  *   Rew┆
0x120…140 6f 72 6b 20 6f 66 20 65 61 72 6c 69 65 72 20 6d 6f 6e 20 70 72 6f 67 72 61 6d 2e 20 20 31 37 20   ┆ork of earlier mon program.  17 ┆
0x140…160 41 75 67 20 38 34 20 2d 20 50 68 69 6c 6c 69 70 20 44 79 6b 73 74 72 61 0a 20 2a 0a 20 2a 2f 0a   ┆Aug 84 - Phillip Dykstra  *  */ ┆
0x160…180 0a 23 69 6e 63 6c 75 64 65 20 22 6d 6f 6e 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 63 75 72 73   ┆ #include "mon.h" #include <curs┆
0x180…1a0 65 73 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 73 69 67 6e 61 6c 2e 68 3e 0a 0a 73 74 72 75 63   ┆es.h> #include <signal.h>  struc┆
0x1a0…1c0 74 09 73 67 74 74 79 62 20 74 74 79 62 3b 0a 69 6e 74 20 64 6f 6e 65 28 29 3b 0a 0a 2f 2a 0a 20   ┆t sgttyb ttyb; int done();  /*  ┆
0x1c0…1e0 2a 20 20 54 68 65 20 6e 61 6d 65 6c 69 73 74 20 61 72 72 61 79 2e 20 20 55 73 65 73 20 74 6f 20   ┆*  The namelist array.  Uses to ┆
0x1e0…200 67 65 74 20 74 68 65 20 6b 65 72 6e 61 6c 20 76 61 72 69 61 62 6c 65 73 20 6e 65 65 64 65 64 0a   ┆get the kernal variables needed ┆
0x200…220 20 2a 20 20 62 79 20 61 6c 6c 20 74 68 65 20 4d 4f 4e 20 72 6f 75 74 69 6e 65 73 2e 20 20 54 68   ┆ *  by all the MON routines.  Th┆
0x220…240 65 20 6f 72 64 65 72 20 6f 66 20 74 68 69 73 20 6c 69 73 74 20 4d 55 53 54 20 63 6f 72 72 65 73   ┆e order of this list MUST corres┆
0x240…260 70 6f 6e 64 0a 20 2a 20 20 74 6f 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 64 65 66   ┆pond  *  to the order of the def┆
0x260…280 69 6e 69 74 69 6f 6e 73 20 69 6e 20 6d 6f 6e 2e 68 0a 20 2a 2f 0a 73 74 72 75 63 74 20 6e 6c 69   ┆initions in mon.h  */ struct nli┆
0x280…2a0 73 74 20 6e 61 6d 65 6c 69 73 74 5b 5d 20 3d 20 7b 0a 09 7b 20 22 5f 64 6b 5f 62 75 73 79 22 20   ┆st namelist[] = {  { "_dk_busy" ┆
0x2a0…2c0 7d 2c 0a 09 7b 20 22 5f 64 6b 5f 6d 73 70 77 22 20 7d 2c 0a 09 7b 20 22 5f 68 7a 22 20 7d 2c 0a   ┆},  { "_dk_mspw" },  { "_hz" }, ┆
0x2c0…2e0 09 7b 20 22 5f 63 70 5f 74 69 6d 65 22 20 7d 2c 0a 09 7b 20 22 5f 72 61 74 65 22 20 7d 2c 0a 09   ┆ { "_cp_time" },  { "_rate" },  ┆
0x2e0…300 7b 20 22 5f 74 6f 74 61 6c 22 20 7d 2c 0a 09 7b 20 22 5f 64 65 66 69 63 69 74 22 20 7d 2c 0a 09   ┆{ "_total" },  { "_deficit" },  ┆
0x300…320 7b 20 22 5f 64 6b 5f 78 66 65 72 22 20 7d 2c 0a 09 7b 20 22 5f 6d 62 64 69 6e 69 74 22 20 7d 2c   ┆{ "_dk_xfer" },  { "_mbdinit" },┆
0x320…340 0a 09 7b 20 22 5f 75 62 64 69 6e 69 74 22 20 7d 2c 0a 09 7b 20 22 5f 69 66 6e 65 74 22 20 7d 2c   ┆  { "_ubdinit" },  { "_ifnet" },┆
0x340…360 0a 09 7b 20 22 5f 64 6b 5f 74 69 6d 65 22 20 7d 2c 0a 09 7b 20 22 5f 64 6b 5f 77 64 73 22 20 7d   ┆  { "_dk_time" },  { "_dk_wds" }┆
0x360…380 2c 0a 09 7b 20 22 5f 64 6b 5f 73 65 65 6b 22 20 7d 2c 0a 09 7b 20 22 5f 74 6b 5f 6e 69 6e 22 20   ┆,  { "_dk_seek" },  { "_tk_nin" ┆
0x380…3a0 7d 2c 0a 09 7b 20 22 5f 74 6b 5f 6e 6f 75 74 22 20 7d 2c 0a 09 7b 20 22 5f 61 76 65 6e 72 75 6e   ┆},  { "_tk_nout" },  { "_avenrun┆
0x3a0…3c0 22 20 7d 2c 0a 09 7b 20 22 5f 63 70 32 5f 74 69 6d 65 22 20 7d 2c 09 2f 2a 20 32 6e 64 20 43 50   ┆" },  { "_cp2_time" }, /* 2nd CP┆
0x3c0…3e0 55 20 73 74 61 74 73 20 2a 2f 0a 09 7b 20 22 5f 73 6c 61 76 65 73 74 61 72 74 22 20 7d 2c 09 2f   ┆U stats */  { "_slavestart" }, /┆
0x3e0…400 2a 20 55 73 65 64 20 74 6f 20 64 65 74 65 63 74 20 32 6e 64 20 43 50 55 20 2a 2f 0a 09 7b 20 30   ┆* Used to detect 2nd CPU */  { 0┆
0x400…420 20 7d 0a 7d 3b 0a 0a 6d 61 69 6e 28 61 72 67 63 2c 61 72 67 76 29 0a 69 6e 74 20 61 72 67 63 3b   ┆ } };  main(argc,argv) int argc;┆
0x420…440 0a 63 68 61 72 20 2a 61 72 67 76 5b 5d 3b 0a 7b 0a 20 20 20 20 20 20 20 20 72 65 67 69 73 74 65   ┆ char *argv[]; {         registe┆
0x440…460 72 20 69 3b 0a 20 20 20 20 20 20 20 20 64 6f 75 62 6c 65 20 66 31 2c 20 66 32 3b 0a 20 20 20 20   ┆r i;         double f1, f2;     ┆
0x460…480 20 20 20 20 65 78 74 65 72 6e 20 63 68 61 72 20 2a 63 74 69 6d 65 28 29 3b 0a 0a 2f 2a 0a 20 2a   ┆    extern char *ctime();  /*  *┆
0x480…4a0 20 66 69 6c 6c 20 74 68 65 20 6e 61 6d 65 6c 69 73 74 20 61 6e 64 20 6f 70 65 6e 20 2f 64 65 76   ┆ fill the namelist and open /dev┆
0x4a0…4c0 2f 6b 6d 65 6d 0a 20 2a 2f 0a 20 20 20 20 20 20 20 20 6e 6c 69 73 74 28 22 2f 76 6d 75 6e 69 78   ┆/kmem  */         nlist("/vmunix┆
0x4c0…4e0 22 2c 20 6e 61 6d 65 6c 69 73 74 29 3b 0a 20 20 20 20 20 20 20 20 69 66 28 6e 61 6d 65 6c 69 73   ┆", namelist);         if(namelis┆
0x4e0…500 74 5b 58 5f 44 4b 5f 42 55 53 59 5d 2e 6e 5f 74 79 70 65 20 3d 3d 20 30 29 20 7b 0a 20 20 20 20   ┆t[X_DK_BUSY].n_type == 0) {     ┆
0x500…520 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 64 6b 5f 62 75 73 79 20 6e 6f 74 20   ┆            printf("dk_busy not ┆
0x520…540 66 6f 75 6e 64 20 69 6e 20 2f 76 6d 75 6e 69 78 20 6e 61 6d 65 6c 69 73 74 5c 6e 22 29 3b 0a 20   ┆found in /vmunix namelist\n");  ┆
0x540…560 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 78 69 74 28 31 29 3b 0a 20 20 20 20 20 20 20 20   ┆               exit(1);         ┆
0x560…580 7d 0a 20 20 20 20 20 20 20 20 6b 6d 65 6d 20 3d 20 6f 70 65 6e 28 22 2f 64 65 76 2f 6b 6d 65 6d   ┆}         kmem = open("/dev/kmem┆
0x580…5a0 22 2c 20 30 29 3b 0a 20 20 20 20 20 20 20 20 69 66 28 6b 6d 65 6d 20 3c 20 30 29 20 7b 0a 20 20   ┆", 0);         if(kmem < 0) {   ┆
0x5a0…5c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 63 61 6e 6e 6f 74 20 6f 70 65   ┆              printf("cannot ope┆
0x5c0…5e0 6e 20 2f 64 65 76 2f 6b 6d 65 6d 5c 6e 22 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20   ┆n /dev/kmem\n");                ┆
0x5e0…600 20 65 78 69 74 28 31 29 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 28 61   ┆ exit(1);         }         if(a┆
0x600…620 72 67 63 20 3e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 76 20 3d 20   ┆rgc > 1)                 intv = ┆
0x620…640 28 61 74 6f 69 28 61 72 67 76 5b 31 5d 29 29 3b 0a 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 6e   ┆(atoi(argv[1]));         else in┆
0x640…660 74 76 20 3d 20 31 3b 0a 0a 2f 2a 20 0a 20 2a 20 64 6f 20 61 6c 6c 20 74 68 69 6e 67 73 20 74 68   ┆tv = 1;  /*   * do all things th┆
0x660…680 61 74 20 6e 65 65 64 20 74 6f 20 62 65 20 64 6f 6e 65 20 6f 6e 6c 79 20 6f 6e 63 65 0a 20 2a 2f   ┆at need to be done only once  */┆
0x680…6a0 0a 20 20 20 20 20 20 20 20 6c 73 65 65 6b 28 6b 6d 65 6d 2c 20 28 6c 6f 6e 67 29 6e 61 6d 65 6c   ┆         lseek(kmem, (long)namel┆
0x6a0…6c0 69 73 74 5b 58 5f 44 4b 5f 4d 53 50 57 5d 2e 6e 5f 76 61 6c 75 65 2c 20 30 29 3b 0a 20 20 20 20   ┆ist[X_DK_MSPW].n_value, 0);     ┆
0x6c0…6e0 20 20 20 20 72 65 61 64 28 6b 6d 65 6d 2c 20 73 2e 64 6b 5f 6d 73 70 77 2c 20 73 69 7a 65 6f 66   ┆    read(kmem, s.dk_mspw, sizeof┆
0x6e0…700 20 73 2e 64 6b 5f 6d 73 70 77 29 3b 0a 20 20 20 20 20 20 20 20 6c 73 65 65 6b 28 6b 6d 65 6d 2c   ┆ s.dk_mspw);         lseek(kmem,┆
0x700…720 20 28 6c 6f 6e 67 29 6e 61 6d 65 6c 69 73 74 5b 58 5f 48 5a 5d 2e 6e 5f 76 61 6c 75 65 2c 20 30   ┆ (long)namelist[X_HZ].n_value, 0┆
0x720…740 29 3b 0a 20 20 20 20 20 20 20 20 72 65 61 64 28 6b 6d 65 6d 2c 20 26 68 7a 2c 20 73 69 7a 65 6f   ┆);         read(kmem, &hz, sizeo┆
0x740…760 66 20 68 7a 29 3b 0a 09 72 65 61 64 5f 6e 61 6d 65 73 28 29 3b 0a 09 64 75 61 6c 63 70 75 20 3d   ┆f hz);  read_names();  dualcpu =┆
0x760…780 20 30 3b 0a 09 69 66 20 28 6e 61 6d 65 6c 69 73 74 5b 58 5f 53 4c 41 56 45 53 54 41 52 54 5d 2e   ┆ 0;  if (namelist[X_SLAVESTART].┆
0x780…7a0 6e 5f 74 79 70 65 29 0a 09 09 64 75 61 6c 63 70 75 2b 2b 3b 20 20 20 20 20 20 20 20 0a 2f 2a 0a   ┆n_type)   dualcpu++;         /* ┆
0x7a0…7c0 20 2a 20 6d 6f 6e 69 74 6f 72 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 65 76 65 72 0a 20 2a   ┆ * monitor parameters forever  *┆
0x7c0…7e0 2f 0a 20 20 20 20 20 20 20 20 77 6f 72 6b 65 72 28 29 3b 0a 20 20 20 20 20 20 20 20 2f 2a 20 4e   ┆/         worker();         /* N┆
0x7e0…800 4f 54 52 45 41 43 48 45 44 20 2a 2f 0a 7d 0a 0a 63 68 61 72 20 6f 62 75 66 5b 42 55 46 53 49 5a   ┆OTREACHED */ }  char obuf[BUFSIZ┆
0x800…820 5d 3b 09 2f 2a 20 4f 75 74 70 75 74 20 62 75 66 66 65 72 20 2a 2f 0a 0a 77 6f 72 6b 65 72 28 29   ┆]; /* Output buffer */  worker()┆
0x820…840 0a 7b 0a 20 20 20 20 20 20 20 20 6c 6f 6e 67 20 63 6c 6f 63 6b 3b 0a 09 73 74 72 75 63 74 20 74   ┆ {         long clock;  struct t┆
0x840…860 69 6d 65 76 61 6c 20 74 69 6e 74 76 3b 0a 09 69 6e 74 20 69 2c 20 74 69 6e 3b 0a 01 49 20 32 0a   ┆imeval tintv;  int i, tin;  I 2 ┆
0x860…880 09 69 6e 74 20 75 73 65 72 73 2c 20 75 73 65 72 5f 63 6f 75 6e 74 28 29 3b 0a 01 45 20 32 0a 0a   ┆ int users, user_count();  E 2  ┆
0x880…8a0 09 2f 2a 20 73 65 74 20 75 70 20 73 69 67 6e 61 6c 73 20 2a 2f 0a 09 73 69 67 6e 61 6c 28 53 49   ┆ /* set up signals */  signal(SI┆
0x8a0…8c0 47 49 4e 54 2c 20 64 6f 6e 65 29 3b 0a 09 73 69 67 6e 61 6c 28 53 49 47 51 55 49 54 2c 20 64 6f   ┆GINT, done);  signal(SIGQUIT, do┆
0x8c0…8e0 6e 65 29 3b 0a 0a 09 2f 2a 20 73 65 74 20 43 42 52 45 41 4b 20 6d 6f 64 65 20 77 69 74 68 20 6e   ┆ne);   /* set CBREAK mode with n┆
0x8e0…900 6f 20 62 75 66 66 65 72 69 6e 67 20 6f 6e 20 73 74 64 69 6e 20 2a 2f 0a 09 73 65 74 62 75 66 28   ┆o buffering on stdin */  setbuf(┆
0x900…920 73 74 64 69 6e 2c 20 30 29 3b 0a 09 73 65 74 62 75 66 28 73 74 64 6f 75 74 2c 20 6f 62 75 66 29   ┆stdin, 0);  setbuf(stdout, obuf)┆
0x920…940 3b 0a 09 69 6f 63 74 6c 28 30 2c 20 54 49 4f 43 47 45 54 50 2c 20 26 74 74 79 62 29 3b 0a 09 74   ┆;  ioctl(0, TIOCGETP, &ttyb);  t┆
0x940…960 74 79 62 2e 73 67 5f 66 6c 61 67 73 20 7c 3d 20 43 42 52 45 41 4b 3b 0a 09 69 6f 63 74 6c 28 66   ┆tyb.sg_flags |= CBREAK;  ioctl(f┆
0x960…980 69 6c 65 6e 6f 28 73 74 64 69 6e 29 2c 20 54 49 4f 43 53 45 54 50 2c 20 28 63 68 61 72 20 2a 29   ┆ileno(stdin), TIOCSETP, (char *)┆
0x980…9a0 26 74 74 79 62 29 3b 0a 0a 09 74 69 6e 74 76 2e 74 76 5f 73 65 63 20 3d 20 69 6e 74 76 3b 0a 09   ┆&ttyb);   tintv.tv_sec = intv;  ┆
0x9a0…9c0 74 69 6e 74 76 2e 74 76 5f 75 73 65 63 20 3d 20 30 3b 0a 09 69 6e 69 74 73 63 72 28 29 3b 09 2f   ┆tintv.tv_usec = 0;  initscr(); /┆
0x9c0…9e0 2a 20 69 6e 69 74 20 63 75 72 73 65 73 20 70 61 63 6b 61 67 65 20 2a 2f 0a 09 6e 69 66 69 6e 69   ┆* init curses package */  nifini┆
0x9e0…a00 74 28 29 3b 09 2f 2a 20 67 65 74 20 69 6e 69 74 69 61 6c 20 6e 65 74 20 69 6e 74 65 72 66 61 63   ┆t(); /* get initial net interfac┆
0xa00…a20 65 73 20 64 61 74 61 20 2a 2f 0a 20 20 20 20 20 20 20 20 64 69 73 70 69 6e 69 74 28 29 3b 20 20   ┆es data */         dispinit();  ┆
0xa20…a40 20 20 20 2f 2a 20 69 6e 69 74 69 61 6c 69 7a 65 20 64 69 73 70 6c 61 79 20 2a 2f 0a 20 20 20 20   ┆   /* initialize display */     ┆
0xa40…a60 20 20 20 20 66 6f 72 28 3b 3b 29 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 76 6d 28   ┆    for(;;){                 vm(┆
0xa60…a80 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6f 28 29 3b 0a 20 20 20 20 20 20 20   ┆);                 io();        ┆
0xa80…aa0 20 09 6e 69 66 75 70 64 61 74 65 28 29 3b 0a 20 20 20 20 20 20 20 20 09 2f 2a 20 67 65 74 20 6c   ┆  nifupdate();          /* get l┆
0xaa0…ac0 6f 61 64 20 61 76 65 72 61 67 65 20 2a 2f 0a 09 09 6c 73 65 65 6b 28 6b 6d 65 6d 2c 20 28 6c 6f   ┆oad average */   lseek(kmem, (lo┆
0xac0…ae0 6e 67 29 6e 61 6d 65 6c 69 73 74 5b 4c 4f 41 44 41 56 5d 2e 6e 5f 76 61 6c 75 65 2c 20 30 29 3b   ┆ng)namelist[LOADAV].n_value, 0);┆
0xae0…b00 0a 09 09 72 65 61 64 28 6b 6d 65 6d 2c 20 26 6c 6f 61 64 61 76 67 5b 30 5d 2c 20 73 69 7a 65 6f   ┆   read(kmem, &loadavg[0], sizeo┆
0xb00…b20 66 20 6c 6f 61 64 61 76 67 29 3b 0a 20 20 20 20 20 20 20 20 09 6d 76 70 72 69 6e 74 77 28 30 2c   ┆f loadavg);          mvprintw(0,┆
0xb20…b40 31 33 2c 22 25 34 2e 32 66 20 25 34 2e 32 66 20 25 34 2e 32 66 20 25 34 2e 32 66 22 2c 20 6c 6f   ┆13,"%4.2f %4.2f %4.2f %4.2f", lo┆
0xb40…b60 61 64 61 76 67 5b 33 5d 2c 20 6c 6f 61 64 61 76 67 5b 30 5d 2c 20 6c 6f 61 64 61 76 67 5b 31 5d   ┆adavg[3], loadavg[0], loadavg[1]┆
0xb60…b80 2c 20 6c 6f 61 64 61 76 67 5b 32 5d 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74   ┆, loadavg[2]);                 t┆
0xb80…ba0 69 6d 65 28 26 63 6c 6f 63 6b 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 76 70   ┆ime(&clock);                 mvp┆
0xba0…bc0 72 69 6e 74 77 28 30 2c 34 30 2c 63 74 69 6d 65 28 26 63 6c 6f 63 6b 29 29 3b 0a 01 49 20 32 0a   ┆rintw(0,40,ctime(&clock));  I 2 ┆
0xbc0…be0 0a 09 09 75 73 65 72 73 20 3d 20 75 73 65 72 5f 63 6f 75 6e 74 28 29 3b 0a 09 09 69 66 20 28 75   ┆   users = user_count();   if (u┆
0xbe0…c00 73 65 72 73 20 3d 3d 20 31 29 0a 09 09 20 20 20 20 6d 76 70 72 69 6e 74 77 28 30 2c 20 37 30 2c   ┆sers == 1)       mvprintw(0, 70,┆
0xc00…c20 20 22 31 20 75 73 65 72 22 29 3b 0a 09 09 65 6c 73 65 0a 09 09 20 20 20 20 6d 76 70 72 69 6e 74   ┆ "1 user");   else       mvprint┆
0xc20…c40 77 28 30 2c 20 37 30 2c 20 22 25 64 20 75 73 65 72 73 22 2c 20 75 73 65 72 73 29 3b 0a 0a 01 45   ┆w(0, 70, "%d users", users);   E┆
0xc40…c60 20 32 0a 20 20 20 20 20 20 20 20 09 64 69 73 70 75 70 64 61 74 65 28 29 3b 0a 20 20 20 20 20 20   ┆ 2          dispupdate();       ┆
0xc60…c80 20 20 09 6d 76 70 72 69 6e 74 77 28 32 33 2c 20 30 2c 20 22 43 4d 44 3e 20 22 29 3b 0a 20 20 20   ┆   mvprintw(23, 0, "CMD> ");    ┆
0xc80…ca0 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66 72 65 73 68 28 29 3b 0a 20 20 20 20 20 20 20 20   ┆             refresh();         ┆
0xca0…cc0 09 74 69 6e 20 3d 20 31 3b 0a 20 20 20 20 20 20 20 20 09 69 20 3d 20 73 65 6c 65 63 74 28 32 2c   ┆ tin = 1;          i = select(2,┆
0xcc0…ce0 20 26 74 69 6e 2c 20 28 69 6e 74 20 2a 29 30 2c 20 28 69 6e 74 20 2a 29 30 2c 20 26 74 69 6e 74   ┆ &tin, (int *)0, (int *)0, &tint┆
0xce0…d00 76 29 3b 0a 20 20 20 20 20 20 20 20 09 69 66 20 28 69 20 26 26 20 74 69 6e 29 20 7b 0a 20 20 20   ┆v);          if (i && tin) {    ┆
0xd00…d20 20 20 20 20 20 09 09 69 20 3d 20 67 65 74 63 68 61 72 28 29 3b 0a 20 20 20 20 20 20 20 20 09 09   ┆       i = getchar();           ┆
0xd20…d40 69 66 20 28 69 20 3d 3d 20 31 32 29 0a 09 09 09 09 64 69 73 70 69 6e 69 74 28 29 3b 0a 20 20 20   ┆if (i == 12)     dispinit();    ┆
0xd40…d60 20 20 20 20 20 09 09 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 27 71 27 29 0a 20 20 20 20 20 20   ┆       else if (i == 'q')       ┆
0xd60…d80 20 20 09 09 09 64 6f 6e 65 28 29 3b 0a 20 20 20 20 20 20 20 20 09 7d 0a 20 20 20 20 20 20 20 20   ┆     done();          }         ┆
0xd80…da0 7d 0a 7d 0a 0a 2f 2a 0a 20 2a 20 44 4f 4e 45 20 2d 20 70 75 74 20 74 68 65 20 74 65 72 6d 20 62   ┆} }  /*  * DONE - put the term b┆
0xda0…dc0 61 63 6b 20 69 6e 20 6e 6f 6e 20 43 42 52 45 41 4b 20 6d 6f 64 65 20 61 6e 64 20 65 78 69 74 2e   ┆ack in non CBREAK mode and exit.┆
0xdc0…de0 0a 20 2a 2f 0a 64 6f 6e 65 28 29 0a 7b 0a 09 69 6f 63 74 6c 28 30 2c 20 54 49 4f 43 47 45 54 50   ┆  */ done() {  ioctl(0, TIOCGETP┆
0xde0…e00 2c 20 26 74 74 79 62 29 3b 0a 09 74 74 79 62 2e 73 67 5f 66 6c 61 67 73 20 26 3d 20 7e 43 42 52   ┆, &ttyb);  ttyb.sg_flags &= ~CBR┆
0xe00…e20 45 41 4b 3b 0a 09 69 6f 63 74 6c 28 66 69 6c 65 6e 6f 28 73 74 64 69 6e 29 2c 20 54 49 4f 43 53   ┆EAK;  ioctl(fileno(stdin), TIOCS┆
0xe20…e40 45 54 50 2c 20 28 63 68 61 72 20 2a 29 26 74 74 79 62 29 3b 0a 09 6d 76 70 72 69 6e 74 77 28 32   ┆ETP, (char *)&ttyb);  mvprintw(2┆
0xe40…e60 33 2c 30 2c 22 5c 6e 22 29 3b 0a 09 72 65 66 72 65 73 68 28 29 3b 0a 09 65 78 69 74 28 31 29 3b   ┆3,0,"\n");  refresh();  exit(1);┆
0xe60…e68 0a 7d 0a 01 45 20 31 0a   ┆ }  E 1 ┆