ninep.c 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. #include <ip.h>
  12. #include <fcall.h>
  13. #include "dat.h"
  14. #include "protos.h"
  15. static int
  16. p_seprint(Msg *m)
  17. {
  18. Fcall f;
  19. char *p;
  20. memset(&f, 0, sizeof(f));
  21. f.type = 0;
  22. f.data = 0; /* protection for %F */
  23. if(convM2S(m->ps, m->pe-m->ps, &f)){
  24. p = m->p;
  25. m->p = seprint(m->p, m->e, "%F", &f);
  26. while(p < m->p){
  27. p = strchr(p, '\n');
  28. if(p == nil)
  29. break;
  30. *p = '\\';
  31. }
  32. } else
  33. dump.seprint(m);
  34. m->pr = nil;
  35. return 0;
  36. }
  37. Proto ninep =
  38. {
  39. "ninep",
  40. nil,
  41. nil,
  42. p_seprint,
  43. nil,
  44. nil,
  45. nil,
  46. defaultframer,
  47. };