blob: f72d668cc0633ab77e785b0f13fe01b2c0845b61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
}
|