/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
*/
-#include <afs/param.h>
#include <afsconfig.h>
+#include <afs/param.h>
-RCSID("$Header$");
+#include <roken.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "afssyscalls.h"
#ifdef AFS_HPUX_ENV
#include <sys/mknod.h>
#endif
+#include "afssyscalls.h"
+
#include "AFS_component_version_number.c"
-void Usage(void)
+void
+Usage(void)
{
printf("Usage: iopen <partition> <inode>\n");
- printf("iopen opens file by inode, then tries to read it, printing it to stdout.\n");
+ printf
+ ("iopen opens file by inode, then tries to read it, printing it to stdout.\n");
exit(1);
}
-main(argc,argv)
-char **argv;
+main(argc, argv)
+ char **argv;
{
char *part;
char buf[5];
- int fd,n;
+ int fd, n;
struct stat status;
Inode ino;
- if (argc != 3) Usage();
+ if (argc != 3)
+ Usage();
part = argv[1];
#ifdef AFS_64BIT_IOPS_ENV
perror("stat");
exit(1);
}
- printf("ino=%lld\n", ino);
+ printf("ino=%" AFS_INT64_FMT "\n", ino);
printf("About to iopen(dev=(%d,%d), inode=%s, mode=%d\n",
- major(status.st_dev), minor(status.st_dev), PrintInode(NULL, ino),
+ major(status.st_dev), minor(status.st_dev), PrintInode(NULL, ino),
O_RDONLY);
fflush(stdout);
fd = IOPEN(status.st_dev, ino, O_RDONLY);
}
printf("iopen successful, fd=%d\n", fd);
while ((n = read(fd, buf, 5)) > 0)
- write(1,buf,n);
- if (n<0)
+ write(1, buf, n);
+ if (n < 0)
perror("read");
exit(0);
}