rem: PFLG_t *p = memchr(Curwin->procflags, Curwin->sortindx, Curwin->maxpflgs); if (p && ++p < Curwin->procflags + Curwin->maxpflgs)
add: PFLG_t *p = Curwin->procflags; while (*p != Curwin->sortindx) ++p; if (++p < Curwin->procflags + Curwin->maxpflgs)
context: static void do_key (unsigned c){      /* standardized 'secure mode' errors */   static const char err_secure[] = "\aUnavailable in secure mode";#ifdef WARN_NOT_SMP      /* standardized 'smp' errors */   static const char err_smp[] = "\aSorry, only 1 cpu detected";#endif   switch (c) {      case '1':#ifdef WARN_NOT_SMP         if (Cpu_tot > 1)            TOGw(Curwin, View_CPUSUM);         else            show_msg(err_smp);#else         TOGw(Curwin, View_CPUSUM);#endif         break;      case 'a':         if (Mode_altscr) Curwin = Curwin->next;         break;      case 'A':         Mode_altscr = !Mode_altscr;         wins_resize(0);         break;      case 'b':         if (VIZCHKc) {            if (!CHKw(Curwin, Show_HICOLS) && !CHKw(Curwin, Show_HIROWS))               show_msg("\aNothing to highlight!");            else {               TOGw(Curwin, Show_HIBOLD);               capsmk(Curwin);            }         }         break;      case 'c':         VIZTOGc(Show_CMDLIN);         break;      case 'd':      case 's':         if (Secure_mode)            show_msg(err_secure);         else {            float tmp =               get_float(fmtmk("Change delay from %.1f to", Delay_time));            if (tmp > -1) Delay_time = tmp;         }         break;      case 'f':         if (VIZCHKc) {            fields_toggle();            win_colsheads(Curwin);         }         break;      case 'F':      case 'O':         if (VIZCHKc) {            fields_sort();            win_colsheads(Curwin);         }         break;      case 'g':         if (Mode_altscr) {            char tmp[GETBUFSIZ];            strcpy(tmp, ask4str(fmtmk("Rename window '%s' to (1-3 chars)"               , Curwin->winname)));            if (tmp[0]) win_names(Curwin, tmp);         }         break;      case 'G':         win_select(0);         break;      case 'h':      case '?':      {  char ch;         printf("%s%s", Cap_clr_scr, Cap_curs_huge);            /* this string is well above ISO C89's minimum requirements! */         show_special(fmtmk(KEYS_help            , procps_version            , Curwin->grpname            , CHKw(Curwin, Show_CTIMES) ? "On" : "Off"            , Delay_time            , Secure_mode ? "On" : "Off"            , Secure_mode ? "" : KEYS_help_unsecured));         chin(0, &ch, 1);         if ('?' == ch || 'h' == ch) {            do {               putp(Cap_clr_scr);               show_special(fmtmk(WINDOWS_help                  , Curwin->grpname                  , Winstk[0]->winname                  , Winstk[1]->winname                  , Winstk[2]->winname                  , Winstk[3]->winname));               chin(0, &ch, 1);               win_select(ch);            } while ('\n' != ch);         }         putp(Cap_curs_norm);      }         break;      case 'i':         VIZTOGc(Show_IDLEPS);         break;      case 'I':#ifdef WARN_NOT_SMP         if (Cpu_tot > 1) {            Mode_irixps = !Mode_irixps;            show_msg(fmtmk("Irix mode %s", Mode_irixps ? "On" : "Off"));         } else            show_msg(err_smp);#else         Mode_irixps = !Mode_irixps;         show_msg(fmtmk("Irix mode %s", Mode_irixps ? "On" : "Off"));#endif         break;      case 'k':         if (Secure_mode) {            show_msg(err_secure);         } else {            int sig, pid = get_int("PID to kill");            if (-1 != pid) {#ifdef UGH_ITS_4_RH               sig = get_signal2(#else               sig = signal_name_to_number(#endif                  ask4str(fmtmk("Kill PID %d with signal [%i]"                     , pid, DEF_SIGNAL)));               if (-1 == sig) sig = DEF_SIGNAL;               if (sig && kill(pid, sig))                  show_msg(fmtmk("\aKill of PID '%d' with '%d' failed: %s"                     , pid, sig, strerror(errno)));            }         }         break;      case 'l':         TOGw(Curwin, View_LOADAV);         break;      case 'm':         TOGw(Curwin, View_MEMORY);         break;      case 'n':      case '#':         if (VIZCHKc) {            int num;            if (-1 < (num = get_int(               fmtmk("Maximum tasks = %d, change to (0 is unlimited)"                  , Curwin->maxtasks))))               Curwin->maxtasks = num;         }         break;      case 'o':         if (VIZCHKc) {            fields_reorder();            win_colsheads(Curwin);         }         break;      case 'q':         stop(0);      case 'r':         if (Secure_mode)            show_msg(err_secure);         else {            int pid, val;            pid = get_int("PID to renice");            if (-1 == pid) break;            val = get_int(fmtmk("Renice PID %d to value", pid));            if (setpriority(PRIO_PROCESS, (unsigned)pid, val))               show_msg(fmtmk("\aRenice of PID %d to %d failed: %s"                  , pid, val, strerror(errno)));         }         break;      case 'R':         VIZTOGc(Qsrt_NORMAL);         break;      case 'S':         if (VIZCHKc) {            TOGw(Curwin, Show_CTIMES);            show_msg(fmtmk("Cumulative time %s"               , CHKw(Curwin, Show_CTIMES) ? "On" : "Off"));         }         break;      case 't':         TOGw(Curwin, View_STATES);         break;      case 'u':         if (VIZCHKc)            strcpy(Curwin->colusrnam, ask4str("Which user (blank for all)"));         break;      case 'w':         if (Mode_altscr) Curwin = Curwin->prev;         break;      case 'W':      {  FILE *fp = fopen(RCfile, "w"); int i;         if (fp) {            fprintf(fp, "RCfile for \"%s with windows\"\t\t# shameless braggin'\n"               , Myname);            fprintf(fp, "Id:%c, "               "Mode_altscr=%d, Mode_irixps=%d, Delay_time=%.3f, Curwin=%d\n"               , RCF_FILEID               , Mode_altscr, Mode_irixps, Delay_time, Curwin - Winstk[0]);            for (i = 0; i < GROUPSMAX; i++) {               fprintf(fp, "%s\tfieldscur=%s\n"                  , Winstk[i]->winname, Winstk[i]->fieldscur);               fprintf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d\n"                  , Winstk[i]->winflags                  , Winstk[i]->sortindx                  , Winstk[i]->maxtasks);               fprintf(fp, "\tsummclr=%d, msgsclr=%d, headclr=%d, taskclr=%d\n"                  , Winstk[i]->summclr                  , Winstk[i]->msgsclr                  , Winstk[i]->headclr                  , Winstk[i]->taskclr);            }            fclose(fp);            show_msg(fmtmk("Wrote configuration to '%s'", RCfile));         } else            show_msg(fmtmk("\aFailed '%s' open: %s", RCfile, strerror(errno)));      }         break;      case 'x':         if (VIZCHKc) {            TOGw(Curwin, Show_HICOLS);            capsmk(Curwin);         }         break;      case 'y':         if (VIZCHKc) {            TOGw(Curwin, Show_HIROWS);            capsmk(Curwin);         }         break;      case 'z':         if (VIZCHKc) {            TOGw(Curwin, Show_COLORS);            capsmk(Curwin);         }         break;      case 'Z':         wins_colors();         break;      case '-':         if (Mode_altscr)            TOGw(Curwin, VISIBLE_tsk);         break;      case '_':         if (Mode_altscr)            wins_reflag(Flags_TOG, VISIBLE_tsk);         break;      case '=':         Curwin->maxtasks = 0;         SETw(Curwin, Show_IDLEPS | VISIBLE_tsk);         Monpidsidx = 0;         break;      case '+':         if (Mode_altscr)            SETw(Curwin, EQUWINS_cwo);         break;      case '<':         if (VIZCHKc) {            PFLG_t *p =               memchr(Curwin->procflags, Curwin->sortindx, Curwin->maxpflgs);            if (p && --p >= Curwin->procflags)               Curwin->sortindx = *p;         }         break;      case '>':         if (VIZCHKc) {            PFLG_t *p =               memchr(Curwin->procflags, Curwin->sortindx, Curwin->maxpflgs);            if (p && ++p < Curwin->procflags + Curwin->maxpflgs)               Curwin->sortindx = *p;         }         break;      case '\n':          /* just ignore these, they'll have the effect */      case ' ':           /* of refreshing display after waking us up ! */         break;      default:         show_msg("\aUnknown command - try 'h' for help");   }}