ucmd_netlog.c 510 B

12345678910111213141516171819202122232425262728
  1. /* netlog: ring-3 command. Send one text line as a UDP datagram. */
  2. #include "ucmd_lib.h"
  3. #define NETLOG_PORT 19290
  4. void _start(const char *arg)
  5. {
  6. unsigned int len = 0;
  7. if (!arg || !arg[0]) {
  8. u_puts("netlog: usage netlog <text>\n");
  9. u_exit(1);
  10. }
  11. while (arg[len])
  12. len++;
  13. if (u_syscall1(SYS_NETLOG, (int)arg) != 0) {
  14. u_puts("netlog: send failed\n");
  15. u_exit(1);
  16. }
  17. u_puts("netlog: sent ");
  18. u_putdec(len);
  19. u_puts(" bytes to UDP port ");
  20. u_putdec(NETLOG_PORT);
  21. u_putc('\n');
  22. u_exit(0);
  23. }