Quote:
Originally Posted by EricTRA
|
Thats it. Certainly not good code, but thats it.
from readproc.c:
Code:
base:
if(unlikely(!*S)) break;
entry = table[63 & (asso[S[3]] + asso[S[2]] + asso[S[0]])];
colon = strchr(S, ':');
if(unlikely(!colon)) break;
if(unlikely(colon[1]!='\t')) break;
if(unlikely(colon-S != entry.len)) continue;
if(unlikely(memcmp(entry.name,S,colon-S))) continue;
S = colon+2; // past the '\t'
#ifdef LABEL_OFFSET
goto *(&&base + entry.offset);
#else
goto *entry.addr;
#endif
case_Name:{
unsigned u = 0;
while(u < sizeof P->cmd - 1u){
int c = *S++;
if(unlikely(c=='\n')) break;
if(unlikely(c=='\0')) break; // should never happen
if(unlikely(c=='\\')){
c = *S++;
if(c=='\n') break; // should never happen
if(!c) break; // should never happen
if(c=='n') c='\n'; // else we assume it is '\\'
}
P->cmd[u++] = c;
}
P->cmd[u] = '\0';
S--; // put back the '\n' or '\0'