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