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