summaryrefslogtreecommitdiffstats
path: root/contrib/ccan/asprintf/_info
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /contrib/ccan/asprintf/_info
parentInitial commit. (diff)
downloadknot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz
knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/ccan/asprintf/_info')
-rw-r--r--contrib/ccan/asprintf/_info45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/ccan/asprintf/_info b/contrib/ccan/asprintf/_info
new file mode 100644
index 0000000..f72d668
--- /dev/null
+++ b/contrib/ccan/asprintf/_info
@@ -0,0 +1,45 @@
+#include "config.h"
+#include <stdio.h>
+#include <string.h>
+
+/**
+ * asprintf - asprintf wrapper (and if necessary, implementation).
+ *
+ * This provides a convenient wrapper for asprintf, and also implements
+ * asprintf if necessary.
+ *
+ * Author: Rusty Russell <rusty@rustcorp.com.au>
+ *
+ * License: MIT
+ *
+ * Example:
+ * #include <ccan/asprintf/asprintf.h>
+ * #include <unistd.h>
+ * #include <err.h>
+ *
+ * int main(int argc, char *argv[])
+ * {
+ * char *p = afmt("This program has %i arguments", argc);
+ * int ret;
+ *
+ * while ((ret = write(STDOUT_FILENO, p, strlen(p))) > 0) {
+ * p += ret;
+ * if (!*p)
+ * exit(0);
+ * }
+ * err(1, "Writing to stdout");
+ * }
+ */
+int main(int argc, char *argv[])
+{
+ /* Expect exactly one argument */
+ if (argc != 2)
+ return 1;
+
+ if (strcmp(argv[1], "depends") == 0) {
+ printf("ccan/compiler\n");
+ return 0;
+ }
+
+ return 1;
+}