rebootcmd.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 "../port/lib.h"
  11. #include "mem.h"
  12. #include "dat.h"
  13. #include "fns.h"
  14. #include "../port/error.h"
  15. #include <elf.h>
  16. /* some day we will want these.
  17. void
  18. readn(Chan *c, void *vp, int32_t n)
  19. {
  20. char *p;
  21. int32_t nn;
  22. p = vp;
  23. while(n > 0) {
  24. nn = c->dev->read(c, p, n, c->offset);
  25. if(nn == 0)
  26. error(Eshort);
  27. c->offset += nn;
  28. p += nn;
  29. n -= nn;
  30. }
  31. }
  32. void
  33. setbootcmd(int argc, char *argv[])
  34. {
  35. char *buf, *p, *ep;
  36. int i;
  37. buf = malloc(1024);
  38. if(buf == nil)
  39. error(Enomem);
  40. p = buf;
  41. ep = buf + 1024;
  42. for(i=0; i<argc; i++)
  43. p = seprint(p, ep, "%q ", argv[i]);
  44. *p = 0;
  45. ksetenv("bootcmd", buf, 1);
  46. free(buf);
  47. }
  48. */
  49. void
  50. rebootcmd(int argc, char *argv[])
  51. {
  52. if (argc == 0)
  53. exit(0);
  54. error("Reboot with a file is not supported yet");
  55. }