rem: static int flags = PROC_FILLMEM | PROC_FILLUSR #ifdef UGH_ITS_4_RH | PROC_FILLCMD #else | PROC_FILLGRP | PROC_FILLCOM #endif | PROC_FILLSTATUS | PROC_FILLSTAT;
context: static proc_t **refreshprocs (proc_t **tbl){#define PTRsz  sizeof(proc_t *)         /* eyeball candy */#define ENTsz  sizeof(proc_t)   static int flags = PROC_FILLMEM | PROC_FILLUSR#ifdef UGH_ITS_4_RH                    | PROC_FILLCMD#else                    | PROC_FILLGRP | PROC_FILLCOM#endif                    | PROC_FILLSTATUS | PROC_FILLSTAT;   static unsigned savmax = 0;          /* first time, Bypass: (i)  */   proc_t *ptsk = (proc_t *)-1;         /* first time, Force: (ii)  */   unsigned curmax = 0;                 /* every time  (jeeze)      */   PROCTAB* PT;   if (Monpidsidx) {      PT = openproc(flags | PROC_PID, Monpids);         /* work around a previous bug in openproc (now corrected) */      PT->procfs = NULL;   } else      PT = openproc(flags);      /* i) Allocated Chunks:  *Existing* table;  refresh + reuse */   while (curmax < savmax) {      if (tbl[curmax]->cmdline) {         free(*tbl[curmax]->cmdline);         tbl[curmax]->cmdline = NULL;      }      if (!(ptsk = readproc(PT, tbl[curmax]))) break;      ++curmax;   }      /* ii) Unallocated Chunks:  *New* or *Existing* table;  extend + fill */   while (ptsk) {         /* realloc as we go, keeping 'tbl' ahead of 'currmax++' */      tbl = alloc_r(tbl, (curmax + 1) * PTRsz);         /* here, readproc will allocate the underlying proc_t stg */      if ((ptsk = readproc(PT, NULL)))         tbl[curmax++] = ptsk;   }   closeproc(PT);      /* iii) Chunkless:  make 'eot' entry, after possible extension */   if (curmax >= savmax) {      tbl = alloc_r(tbl, (curmax + 1) * PTRsz);         /* here, we must allocate the underlying proc_t stg ourselves */      tbl[curmax] = alloc_c(ENTsz);      savmax = curmax + 1;   }      /* this frame's end, but not necessarily end of allocated space */   tbl[curmax]->pid = -1;   return tbl;#undef PTRsz#undef ENTsz}