static void do_unsubscribe(const char *action) { int r; if (!issub(workdir,target.s,0)) { getoff(ACTION_UC); copybottom(0); qmail_to(&qq,target.s); } else if (flagunsubconf) { if (ismod && remote.s != 0) { doconfirm(ACTION_WC); copy_act("text/mod-unsub-confirm"); copybottom(0); qmail_to(&qq,mod.s); } else { doconfirm(ACTION_UC); copy_act("text/unsub-confirm"); copybottom(0); qmail_to(&qq,target.s); } } else if (flagunsubismod && modsub.s != 0) { doconfirm(ACTION_VC); copy_act("text/mod-unsub-confirm"); copybottom(0); sendtomods(); } else { r = getoff(action); copybottom(0); if (!r || flagnotify) qmail_to(&qq,target.s); /* tell owner if problems (-Q) or anyway (-QQ) */ if (flagcopyowner && (!r || flagcopyowner > 1)) to_owner(); } }
static void do_uc(const char *action) { int r; if (hashok(action,ACTION_UC)) { /* unsub is moderated only on moderated list if -m unless the */ /* target == sender == a moderator */ if (flagunsubismod && modsub.s != 0) { doconfirm(ACTION_VC); copy_act("text/mod-unsub-confirm"); copybottom(0); sendtomods(); } else { r = getoff(action); copybottom(0); if (!r || flagnotify) qmail_to(&qq,target.s); /* tell owner if problems (-Q) or anyway (-QQ) */ if (flagcopyowner && (!r || flagcopyowner > 1)) to_owner(); } } else { doconfirm(ACTION_UC); copy_act("text/unsub-bad"); copybottom(0); qmail_to(&qq,target.s); } }
static void printinst (const Instruction *op, const Instruction *p) { const char *const names[] = { "any", "char", "set", "testany", "testchar", "testset", "span", "behind", "ret", "end", "choice", "jmp", "call", "open_call", "commit", "partial_commit", "back_commit", "failtwice", "fail", "giveup", "fullcapture", "opencapture", "closecapture", "closeruntime" }; printf("%02ld: %s ", (long)(p - op), names[p->i.code]); switch ((Opcode)p->i.code) { case IChar: { printf("'%c'", p->i.aux); break; } case ITestChar: { printf("'%c'", p->i.aux); printjmp(op, p); break; } case IFullCapture: { printcapkind(getkind(p)); printf(" (size = %d) (idx = %d)", getoff(p), p->i.key); break; } case IOpenCapture: { printcapkind(getkind(p)); printf(" (idx = %d)", p->i.key); break; } case ISet: { printcharset((p+1)->buff); break; } case ITestSet: { printcharset((p+2)->buff); printjmp(op, p); break; } case ISpan: { printcharset((p+1)->buff); break; } case IOpenCall: { printf("-> %d", (p + 1)->offset); break; } case IBehind: { printf("%d", p->i.aux); break; } case IJmp: case ICall: case ICommit: case IChoice: case IPartialCommit: case IBackCommit: case ITestAny: { printjmp(op, p); break; } default: break; } printf("\n"); }
static void do_vc_wc(const char *action,const char *ac) { int r; if (hashok(action,ac)) { r = getoff(action); if (!r && modsub.s != 0) strerr_die2x(0,INFO,MSG(ERR_UNSUB_NOP)); mod_bottom(); if (r) { /* success to target */ if (flagnotify) qmail_to(&qq,target.s); if (flagcopyowner > 1) to_owner(); } else /* NOP to sender = admin. Will take */ qmail_to(&qq,sender); /* care of it. No need to tell owner */ /* if list is moderated skip - otherwise bad with > 1 mod */ } else { if (!ismod || remote.s == 0) /* else anyone can get a good -vc. */ die_cookie(); doconfirm(ac); copy_act("text/unsub-bad"); copybottom(0); qmail_to(&qq,mod.s); } }
/* ** Opcode interpreter */ const char *match (lua_State *L, const char *o, const char *s, const char *e, Instruction *op, Capture *capture, int ptop) { Stack stackbase[INITBACK]; Stack *stacklimit = stackbase + INITBACK; Stack *stack = stackbase; /* point to first empty slot in stack */ int capsize = INITCAPSIZE; int captop = 0; /* point to first empty slot in captures */ int ndyncap = 0; /* number of dynamic captures (in Lua stack) */ const Instruction *p = op; /* current instruction */ stack->p = &giveup; stack->s = s; stack->caplevel = 0; stack++; lua_pushlightuserdata(L, stackbase); for (;;) { //#if defined(DEBUG) // printf("s: |%s| stck:%d, dyncaps:%d, caps:%d ", // s, stack - getstackbase(L, ptop), ndyncap, captop); /*printinst(op, p); printcaplist(capture, capture + captop);*/ //#endif assert(stackidx(ptop) + ndyncap == lua_gettop(L) && ndyncap <= captop); switch ((Opcode)p->i.code) { case IEnd: { assert(stack == getstackbase(L, ptop) + 1); capture[captop].kind = Cclose; capture[captop].s = NULL; return s; } case IGiveup: { assert(stack == getstackbase(L, ptop)); return NULL; } case IRet: { assert(stack > getstackbase(L, ptop) && (stack - 1)->s == NULL); p = (--stack)->p; continue; } case IAny: { if (s < e) { p++; s++; } else goto fail; continue; } case ITestAny: { if (s < e) p += 2; else p += getoffset(p); continue; } case IChar: { if ((byte)*s == p->i.aux && s < e) { p++; s++; } else goto fail; continue; } case ITestChar: { if ((byte)*s == p->i.aux && s < e) p += 2; else p += getoffset(p); continue; } case ISet: { int c = (byte)*s; if (testchar((p+1)->buff, c) && s < e) { p += CHARSETINSTSIZE; s++; } else goto fail; continue; } case ITestSet: { int c = (byte)*s; if (testchar((p + 2)->buff, c) && s < e) p += 1 + CHARSETINSTSIZE; else p += getoffset(p); continue; } case IBehind: { int n = p->i.aux; if (n > s - o) goto fail; s -= n; p++; continue; } case ISpan: { for (; s < e; s++) { int c = (byte)*s; if (!testchar((p+1)->buff, c)) break; } p += CHARSETINSTSIZE; continue; } case IJmp: { p += getoffset(p); continue; } case IChoice: { if (stack == stacklimit) stack = doublestack(L, &stacklimit, ptop); stack->p = p + getoffset(p); stack->s = s; stack->caplevel = captop; stack++; p += 2; continue; } case ICall: { if (stack == stacklimit) stack = doublestack(L, &stacklimit, ptop); stack->s = NULL; stack->p = p + 2; /* save return address */ stack++; p += getoffset(p); continue; } case ICommit: { assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL); stack--; p += getoffset(p); continue; } case IPartialCommit: { assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL); (stack - 1)->s = s; (stack - 1)->caplevel = captop; p += getoffset(p); continue; } case IBackCommit: { assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL); s = (--stack)->s; captop = stack->caplevel; p += getoffset(p); continue; } case IFailTwice: assert(stack > getstackbase(L, ptop)); stack--; /* go through */ case IFail: fail: { /* pattern failed: try to backtrack */ do { /* remove pending calls */ assert(stack > getstackbase(L, ptop)); s = (--stack)->s; } while (s == NULL); if (ndyncap > 0) /* is there matchtime captures? */ ndyncap -= removedyncap(L, capture, stack->caplevel, captop); captop = stack->caplevel; p = stack->p; continue; } case ICloseRunTime: { CapState cs; int rem, res, n; int fr = lua_gettop(L) + 1; /* stack index of first result */ cs.s = o; cs.L = L; cs.ocap = capture; cs.ptop = ptop; n = runtimecap(&cs, capture + captop, s, &rem); /* call function */ captop -= n; /* remove nested captures */ fr -= rem; /* 'rem' items were popped from Lua stack */ res = resdyncaptures(L, fr, s - o, e - o); /* get result */ if (res == -1) /* fail? */ goto fail; s = o + res; /* else update current position */ n = lua_gettop(L) - fr + 1; /* number of new captures */ ndyncap += n - rem; /* update number of dynamic captures */ if (n > 0) { /* any new capture? */ if ((captop += n + 2) >= capsize) { capture = doublecap(L, capture, captop, ptop); capsize = 2 * captop; } /* add new captures to 'capture' list */ adddyncaptures(s, capture + captop - n - 2, n, fr); } p++; continue; } case ICloseCapture: { const char *s1 = s; assert(captop > 0); /* if possible, turn capture into a full capture */ if (capture[captop - 1].siz == 0 && s1 - capture[captop - 1].s < UCHAR_MAX) { capture[captop - 1].siz = s1 - capture[captop - 1].s + 1; p++; continue; } else { capture[captop].siz = 1; /* mark entry as closed */ capture[captop].s = s; goto pushcapture; } } case IOpenCapture: capture[captop].siz = 0; /* mark entry as open */ capture[captop].s = s; goto pushcapture; case IFullCapture: capture[captop].siz = getoff(p) + 1; /* save capture size */ capture[captop].s = s - getoff(p); /* goto pushcapture; */ pushcapture: { capture[captop].idx = p->i.key; capture[captop].kind = getkind(p); if (++captop >= capsize) { capture = doublecap(L, capture, captop, ptop); capsize = 2 * captop; } p++; continue; } default: assert(0); return NULL; } } }
ea_t get_chunk_end(ea_t addr) { if ( getoff(addr) == 0 ) return 0; return lastvp->end; }
ea_t get_chunk_start(ea_t addr) { if ( getoff(addr) == 0 ) return BADADDR; return lastvp->start; }
// if not exist, returns -1 asize_t chunksize(ea_t addr) { if ( getoff(addr) == 0 ) return 0; return lastvp->end - lastvp->start; }
bool enabled (ea_t addr) // is enabled ? { return getoff(addr) != 0; }