_info 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "config.h"
  4. /**
  5. * read_write_all - read_all and write_all routines.
  6. *
  7. * Successful read and write calls may only partly complete if a
  8. * signal is received or they are not operating on a normal file.
  9. *
  10. * read_all() and write_all() do the looping for you.
  11. *
  12. * Example:
  13. * #include <err.h>
  14. * #include <stdio.h>
  15. * #include <unistd.h>
  16. * #include <ccan/read_write_all/read_write_all.h>
  17. *
  18. * #define BUFFER_SIZE 10
  19. * int main(int argc, char *argv[])
  20. * {
  21. * char buffer[BUFFER_SIZE+1];
  22. *
  23. * if (!read_all(STDIN_FILENO, buffer, BUFFER_SIZE))
  24. * err(1, "Could not read %u characters", BUFFER_SIZE);
  25. * buffer[BUFFER_SIZE] = '\0';
  26. * printf("I read '%.*s'\n", BUFFER_SIZE, buffer);
  27. * return 0;
  28. * }
  29. *
  30. * Licence: LGPL (2 or any later version)
  31. * Author: Rusty Russell <rusty@rustcorp.com.au>
  32. */
  33. int main(int argc, char *argv[])
  34. {
  35. if (argc != 2)
  36. return 1;
  37. if (strcmp(argv[1], "depends") == 0) {
  38. return 0;
  39. }
  40. return 1;
  41. }