rem: rc->win[0].fieldscur[i] = C;
add: while (( tmp=strchr(fields,'J') )) *tmp='j'; while (( tmp=strchr(fields,'j') )) { char *dst = tmp; char *src = tmp+1; int n = strlen(src) + 1; memmove(dst,src,n); } tmp = strchr(fields,'.'); *tmp = letter;
context: static int read_config_rik (const char * const fbuf, ssize_t num, RCF_t * const rc){   int i;   int cnt;   const char *cp;   unsigned c_show = 0;   unsigned C_show = 0;   int badchar = 0; // allow a limited number of duplicates and junk   char scoreboard[256];   (void)num;   cp = fbuf+2;  // skip the "\n\n" we stuck at the beginning   cnt = strspn(cp,"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz[{\\|]}^~");   if(cnt<22) return -1;  // catch junk, but not good files (had 25 chars in one)   if(cnt>37) return -1;  // catch junk, but not good files (had 29 chars in one)   if(cp[cnt] != '\n') return -2;   i = cnt;   rc->win[0].fieldscur[i] = '\0';   memset(scoreboard, '\0', sizeof scoreboard);   while (i--) {                        // go over each letter of the format string      int c = cp[i] & 0xffu;      int C = rik_to_jim(c);//      fprintf(stderr, "0x%02x -> 0x%02x, <%c> -> <%c>, %d\n",//           c,C,c,C,badchar); // debug      if (~c & 0x20) c_show |= 1 << (c & 0x1f); // 0x20 means lowercase means hidden      if(scoreboard[c|0xe0u]) badchar++; // duplicates not allowed//      fprintf(stderr, "badchar=<%c> 0x%02x\n",badchar, (unsigned char)badchar); for(;;);  // debug      scoreboard[c|0xe0u] = 1;      if (C) {         if (~C & 0x20) C_show |= 1 << (C & 0x1f); // 0x20 means lowercase means hidden         if(scoreboard[C&0x1fu]) badchar++; // duplicates not allowed         scoreboard[C&0x1fu] = 1;      } else {         badchar++;         C = '.';     // a value we hope will be ignored on output      }      rc->win[0].fieldscur[i] = C;   }//   fprintf(stderr, "badchar=%d\n",badchar); for(;;);  // debug   if (badchar > 4) return -9; // Rik messed up his format string, so allow 4   if (!c_show) return -10;   // nothing was shown   if (!C_show) return -11;   // nothing will be shown//fprintf(stderr,"converted <%s>\n",rc->win[0].fieldscur);//for(;;);   cp += cnt;   cp++;  // go past newline which we already checked   // rest of file is optional, but better look right if it exists   if (!*cp) return 12;   if (*cp < '2' || *cp > '9') return -13;  // stupid, and why isn't a '1' valid?   rc->Delay_time = *cp - '0';   memset(scoreboard, '\0', sizeof scoreboard);   for(;;){      int c = *++cp & 0xffu;  // protect scoreboard[] from negative char      if (!c) return -14;  // not OK to hit EOL w/o '\n'      if (c=='\n') break;      switch (c) {         case '0' ... '9':         case ' ':         case '.':            return -15;  // not supposed to have digits here         case 's':            rc->Secure_mode = 1;            break;         case 'S':            rc->win[0].winflags |= Show_CTIMES;            break;         case 'c':            rc->win[0].winflags |= Show_CMDLIN;            break;         case 'i':            rc->win[0].winflags &= ~Show_IDLEPS;            break;         case 'H':  // 'H' means to show threads            //rc->win[0].winflags |= ;            break;         case 'm':            rc->win[0].winflags &= ~View_MEMORY;            break;         case 'l':            rc->win[0].winflags &= ~View_LOADAV;            break;         case 't':            rc->win[0].winflags &= ~View_STATES;            break;         case 'I':            rc->Mode_irixps = 0;            break;         case 'M':            c = 0; // for scoreboard            rc->win[0].sortindx = P_MEM;            break;         case 'P':            c = 0; // for scoreboard            rc->win[0].sortindx = P_CPU;            break;         case 'A':            c = 0; // for scoreboard            rc->win[0].sortindx = P_PID;  // should be by start_time            break;         case 'T':            c = 0; // for scoreboard            rc->win[0].sortindx = P_TM2;            break;         case 'N':            c = 0; // for scoreboard            rc->win[0].sortindx = P_PID;            break;         default:            // just ignore it, except for the scoreboard of course            break;      }      if(scoreboard[c]) return -16; // duplicates not allowed      scoreboard[c] = 1;   }   return 17;}