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