plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

ninep.c (554B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <ip.h>
      4 #include <fcall.h>
      5 #include "dat.h"
      6 #include "protos.h"
      7 
      8 static int
      9 p_seprint(Msg *m)
     10 {
     11 	Fcall f;
     12 	char *p;
     13 
     14 	memset(&f, 0, sizeof(f));
     15 	f.type = 0;
     16 	f.data = 0;	/* protection for %F */
     17 	if(convM2S(m->ps, m->pe-m->ps, &f)){
     18 		p = m->p;
     19 		m->p = seprint(m->p, m->e, "%F", &f);
     20 		while(p < m->p){
     21 			p = strchr(p, '\n');
     22 			if(p == nil)
     23 				break;
     24 			*p = '\\';
     25 		}
     26 	} else
     27 		dump.seprint(m);
     28 	m->pr = nil;
     29 	return 0;
     30 }
     31 
     32 Proto ninep =
     33 {
     34 	"ninep",
     35 	nil,
     36 	nil,
     37 	p_seprint,
     38 	nil,
     39 	nil,
     40 	nil,
     41 	defaultframer
     42 };