Sync usage with man page.
[netbsd-mini2440.git] / sbin / mount_portal / examples / fing.c
blobe7aef5a0e3e0fa0db3d00ca93d458fa37331829e
1 #include <err.h>
2 #include <stdio.h>
4 int
5 main(argc, argv)
6 int argc;
7 char **argv;
9 FILE *fp;
10 char *fingerpath = "portal/tcp/localhost/finger";
11 char *name = "";
12 #define FING_BUFSIZE 16384
13 char buff[FING_BUFSIZE];
14 int n;
16 if (argc > 2)
17 errx(1, "Error: usage: %s [name]", argv[0]);
18 fp = fopen(fingerpath, "r+");
19 if (!fp)
20 err(1, "open of %s", fingerpath);
21 if (argv[1])
22 name = argv[1];
23 fprintf(fp, "%s\n", name);
24 n = fread(buff, (size_t) 1, FING_BUFSIZE, fp);
25 fwrite(buff, (size_t) 1, n, stdout);
26 return 0;