ninep.c 555 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. static int
  8. p_seprint(Msg *m)
  9. {
  10. Fcall f;
  11. char *p;
  12. memset(&f, 0, sizeof(f));
  13. f.type = 0;
  14. f.data = 0; /* protection for %F */
  15. if(convM2S(m->ps, m->pe-m->ps, &f)){
  16. p = m->p;
  17. m->p = seprint(m->p, m->e, "%F", &f);
  18. while(p < m->p){
  19. p = strchr(p, '\n');
  20. if(p == nil)
  21. break;
  22. *p = '\\';
  23. }
  24. } else
  25. dump.seprint(m);
  26. m->pr = nil;
  27. return 0;
  28. }
  29. Proto ninep =
  30. {
  31. "ninep",
  32. nil,
  33. nil,
  34. p_seprint,
  35. nil,
  36. nil,
  37. nil,
  38. defaultframer,
  39. };