Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / sys / istat.c
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 #include <roken.h>
14
15 #include "AFS_component_version_number.c"
16
17 main(argc, argv)
18 char **argv;
19 {
20
21 int fd;
22 int ino;
23 struct stat status;
24
25 if (stat(argv[1], &status) == -1) {
26 perror("stat");
27 exit(1);
28 }
29 ino = atoi(argv[2]);
30 fd = xiopen(status.st_dev, ino, O_RDONLY);
31 if (fd == -1) {
32 perror("iopen");
33 exit(1);
34 }
35 if (fstat(fd, &status) == -1) {
36 perror("fstat");
37 exit(1);
38 }
39 printf("links=%d, size=%d\n", status.st_nlink, status.st_size);
40 exit(0);
41 }