1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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,
};
|