new goodies
This commit is contained in:
parent
35d26aa321
commit
87a52e0485
44 changed files with 8723 additions and 0 deletions
55
src/cmd/ip/snoopy/ninep.c
Executable file
55
src/cmd/ip/snoopy/ninep.c
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <ip.h>
|
||||
#include <fcall.h>
|
||||
#include "dat.h"
|
||||
#include "protos.h"
|
||||
|
||||
static void
|
||||
p_compile(Filter *f)
|
||||
{
|
||||
sysfatal("unknown ninep field: %s", f->s);
|
||||
}
|
||||
|
||||
static int
|
||||
p_filter(Filter *f, Msg *m)
|
||||
{
|
||||
USED(f);
|
||||
USED(m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
p_seprint(Msg *m)
|
||||
{
|
||||
Fcall f;
|
||||
char *p;
|
||||
|
||||
memset(&f, 0, sizeof(f));
|
||||
f.type = 0;
|
||||
f.data = 0; /* protection for %F */
|
||||
if(convM2S(m->ps, m->pe-m->ps, &f)){
|
||||
p = m->p;
|
||||
m->p = seprint(m->p, m->e, "%F", &f);
|
||||
while(p < m->p){
|
||||
p = strchr(p, '\n');
|
||||
if(p == nil)
|
||||
break;
|
||||
*p = '\\';
|
||||
}
|
||||
} else
|
||||
dump.seprint(m);
|
||||
m->pr = nil;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Proto ninep =
|
||||
{
|
||||
"ninep",
|
||||
p_compile,
|
||||
p_filter,
|
||||
p_seprint,
|
||||
nil,
|
||||
nil,
|
||||
defaultframer,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue