]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/rc/pfnc.c
audiohda: fix syntax error
[plan9front.git] / sys / src / cmd / rc / pfnc.c
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         Xrdwr, "Xrdwr",
22         Xread, "Xread",
23         Xreturn, "Xreturn",
24         Xtrue, "Xtrue",
25         Xif, "Xif",
26         Xwastrue, "Xwastrue",
27         Xword, "Xword",
28         Xwrite, "Xwrite",
29         Xmatch, "Xmatch",
30         Xcase, "Xcase",
31         Xconc, "Xconc",
32         Xassign, "Xassign",
33         Xdol, "Xdol",
34         Xcount, "Xcount",
35         Xlocal, "Xlocal",
36         Xunlocal, "Xunlocal",
37         Xfn, "Xfn",
38         Xdelfn, "Xdelfn",
39         Xpipe, "Xpipe",
40         Xpipewait, "Xpipewait",
41         Xpopredir, "Xpopredir",
42         Xrdcmds, "Xrdcmds",
43         (void (*)(void))Xerror, "Xerror",
44         Xbackq, "Xbackq",
45         Xpipefd, "Xpipefd",
46         Xsubshell, "Xsubshell",
47         Xdelhere, "Xdelhere",
48         Xfor, "Xfor",
49         Xglob, "Xglob",
50         Xglobs, "Xglobs",
51         Xrdfn, "Xrdfn",
52         Xsimple, "Xsimple",
53         Xqw, "Xqw",
54         Xsrcline, "Xsrcline",
55 0};
56
57 void
58 pfnc(io *fd, thread *t)
59 {
60         int i;
61         void (*fn)(void) = t->code[t->pc].f;
62         list *a;
63
64         pfmt(fd, "%s:%d: pid %d cycle %p %d ", t->cmdfile, t->line, getpid(), t->code, t->pc);
65         for(i = 0;fname[i].f;i++) if(fname[i].f==fn){
66                 pstr(fd, fname[i].name);
67                 break;
68         }
69         if(!fname[i].f)
70                 pfmt(fd, "%p", fn);
71         for(a = t->argv;a;a = a->next) pfmt(fd, " (%v)", a->words);
72         pchr(fd, '\n');
73         flush(fd);
74 }