blob: d70cbd1d1571e431a46819f91a9d854e9ca01643 (
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
|
#include <stdio.h>
#include <string.h>
#include "config.h"
/**
* read_write_all - read_all and write_all routines.
*
* Successful read and write calls may only partly complete if a
* signal is received or they are not operating on a normal file.
*
* read_all() and write_all() do the looping for you.
*
* Example:
* #include <err.h>
* #include <stdio.h>
* #include <unistd.h>
* #include <ccan/read_write_all/read_write_all.h>
*
* #define BUFFER_SIZE 10
* int main(int argc, char *argv[])
* {
* char buffer[BUFFER_SIZE+1];
*
* if (!read_all(STDIN_FILENO, buffer, BUFFER_SIZE))
* err(1, "Could not read %u characters", BUFFER_SIZE);
* buffer[BUFFER_SIZE] = '\0';
* printf("I read '%.*s'\n", BUFFER_SIZE, buffer);
* return 0;
* }
*
* License: LGPL (v2.1 or any later version)
* Author: Rusty Russell <rusty@rustcorp.com.au>
*/
int main(int argc, char *argv[])
{
if (argc != 2)
return 1;
if (strcmp(argv[1], "depends") == 0) {
return 0;
}
return 1;
}
|