_info 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <string.h>
  2. #include "config.h"
  3. /**
  4. * asprintf - asprintf wrapper (and if necessary, implementation).
  5. *
  6. * This provides a convenient wrapper for asprintf, and also implements
  7. * asprintf if necessary.
  8. *
  9. * Author: Rusty Russell <rusty@rustcorp.com.au>
  10. *
  11. * License: MIT
  12. *
  13. * Example:
  14. * #include <ccan/asprintf/asprintf.h>
  15. * #include <unistd.h>
  16. * #include <err.h>
  17. *
  18. * int main(int argc, char *argv[])
  19. * {
  20. * char *p = afmt("This program has %i arguments", argc);
  21. * int ret;
  22. *
  23. * while ((ret = write(STDOUT_FILENO, p, strlen(p))) > 0) {
  24. * p += ret;
  25. * if (!*p)
  26. * exit(0);
  27. * }
  28. * err(1, "Writing to stdout");
  29. * }
  30. */
  31. int main(int argc, char *argv[])
  32. {
  33. /* Expect exactly one argument */
  34. if (argc != 2)
  35. return 1;
  36. if (strcmp(argv[1], "depends") == 0) {
  37. printf("ccan/compiler\n");
  38. return 0;
  39. }
  40. return 1;
  41. }