]> git.ozlabs.org Git - ccan/blob - ccan/nfs/_info
fa77010bfdcd2d27ea1f131ef3da6d4e9696d3ec
[ccan] / ccan / nfs / _info
1 #include <string.h>
2 #include <stdio.h>
3
4 /**
5  * nfs - nfs client library
6  *
7  * This code offers a POSIX-like interface directly to an NFS server.
8  *
9  * Note: various files are generated from the XDR descriptions in the rpc/
10  * directory using rpcgen.
11  *
12  * Example:
13  * #include <ccan/nfs/nfs.h>
14  * #include <err.h>
15  * #include <stdio.h>
16  * #include <sys/types.h>
17  * #include <sys/stat.h>
18  * #include <unistd.h>
19  *
20  * int main(int argc, char *argv[])
21  * {
22  *      struct nfs_context *nfs;
23  *      struct stat st;
24  *
25  *      if (argc != 4)
26  *              errx(1, "Usage: %s <serveraddr> <export> <filename>", argv[0]);
27  *      nfs = nfs_init_context();
28  *      if (!nfs)
29  *              err(1, "Initializing nfs context");
30  *
31  *      if (nfs_mount_sync(nfs, argv[1], argv[2]) != 0)
32  *              errx(1, "Failed to mount nfs share: %s", nfs_get_error(nfs));
33  *
34  *      if (nfs_stat_sync(nfs, argv[3], &st) != 0)
35  *              errx(1, "Failed to stat(%s): %s", argv[3], nfs_get_error(nfs));
36  *
37  *      printf("Mode %04o\n", st.st_mode);
38  *      printf("Size %u\n", (int)st.st_size);
39  *      printf("Inode %u\n", (int)st.st_ino);
40  *
41  *      nfs_destroy_context(nfs);
42  *      printf("nfsclient finished\n");
43  *      return 0;
44  *}
45  */
46 int main(int argc, char *argv[])
47 {
48         /* Expect exactly one argument */
49         if (argc != 2)
50                 return 1;
51
52         if (strcmp(argv[1], "depends") == 0) {
53                 printf("ccan/compiler\n");
54                 return 0;
55         }
56
57         return 1;
58 }