Annotation of lucent/sys/src/cmd/rc/pfnc.c, revision 1.1

1.1     ! root        1: #include "rc.h"
        !             2: #include "exec.h"
        !             3: #include "io.h"
        !             4: #include "fns.h"
        !             5: struct{
        !             6:        void (*f)(void);
        !             7:        char *name;
        !             8: }fname[]={
        !             9:        Xappend, "Xappend",
        !            10:        Xasync, "Xasync",
        !            11:        Xbang, "Xbang",
        !            12:        Xclose, "Xclose",
        !            13:        Xdup, "Xdup",
        !            14:        Xeflag, "Xeflag",
        !            15:        Xexit, "Xexit",
        !            16:        Xfalse, "Xfalse",
        !            17:        Xifnot, "Xifnot",
        !            18:        Xjump, "Xjump",
        !            19:        Xmark, "Xmark",
        !            20:        Xpopm, "Xpopm",
        !            21:        Xread, "Xread",
        !            22:        Xreturn, "Xreturn",
        !            23:        Xtrue, "Xtrue",
        !            24:        Xif, "Xif",
        !            25:        Xwastrue, "Xwastrue",
        !            26:        Xword, "Xword",
        !            27:        Xwrite, "Xwrite",
        !            28:        Xmatch, "Xmatch",
        !            29:        Xcase, "Xcase",
        !            30:        Xconc, "Xconc",
        !            31:        Xassign, "Xassign",
        !            32:        Xdol, "Xdol",
        !            33:        Xcount, "Xcount",
        !            34:        Xlocal, "Xlocal",
        !            35:        Xunlocal, "Xunlocal",
        !            36:        Xfn, "Xfn",
        !            37:        Xdelfn, "Xdelfn",
        !            38:        Xpipe, "Xpipe",
        !            39:        Xpipewait, "Xpipewait",
        !            40:        Xrdcmds, "Xrdcmds",
        !            41:        (void (*)(void))Xerror, "Xerror",
        !            42:        Xbackq, "Xbackq",
        !            43:        Xpipefd, "Xpipefd",
        !            44:        Xsubshell, "Xsubshell",
        !            45:        Xdelhere, "Xdelhere",
        !            46:        Xfor, "Xfor",
        !            47:        Xglob, "Xglob",
        !            48:        Xrdfn, "Xrdfn",
        !            49:        Xsimple, "Xsimple",
        !            50:        Xrdfn, "Xrdfn",
        !            51:        Xqdol, "Xqdol",
        !            52: 0};
        !            53: void pfnc(io *fd, thread *t)
        !            54: {
        !            55:        int i;
        !            56:        void (*fn)(void)=t->code[t->pc].f;
        !            57:        list *a;
        !            58:        pfmt(fd, "pid %d cycle %p %d ", getpid(), t->code, t->pc);
        !            59:        for(i=0;fname[i].f;i++) if(fname[i].f==fn){
        !            60:                pstr(fd, fname[i].name);
        !            61:                break;
        !            62:        }
        !            63:        if(!fname[i].f) pfmt(fd, "%p", fn);
        !            64:        for(a=t->argv;a;a=a->next) pfmt(fd, " (%v)", a->words);
        !            65:        pchr(fd, '\n');
        !            66:        flush(fd);
        !            67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.