5180c250ed72b2e45732b6c58fb038201e2467fd
[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
14 #include <sys/types.h>
15 #include <sys/stat.h>
16 #include <sys/file.h>
17 #include <stdio.h>
18
19 #include "AFS_component_version_number.c"
20
21 main(argc, argv)
22      char **argv;
23 {
24
25     int fd;
26     int ino;
27     struct stat status;
28
29     if (stat(argv[1], &status) == -1) {
30         perror("stat");
31         exit(1);
32     }
33     ino = atoi(argv[2]);
34     fd = xiopen(status.st_dev, ino, O_RDONLY);
35     if (fd == -1) {
36         perror("iopen");
37         exit(1);
38     }
39     if (fstat(fd, &status) == -1) {
40         perror("fstat");
41         exit(1);
42     }
43     printf("links=%d, size=%d\n", status.st_nlink, status.st_size);
44     exit(0);
45 }