ubase/readahead.c

39 lines
579 B
C
Raw Normal View History

2014-06-27 16:02:42 +00:00
/* See LICENSE file for copyright and license details. */
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
2014-06-30 18:03:41 +00:00
2014-06-27 16:02:42 +00:00
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s file...\n", argv0);
}
int
main(int argc, char *argv[])
{
FILE *fp;
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc == 0)
usage();
for (; argc > 0; argc--, argv++) {
if (!(fp = fopen(argv[0], "r"))) {
weprintf("fopen %s:", argv[0]);
continue;
}
if (readahead(fileno(fp), 0, -1) < 0)
weprintf("readahead %s:", argv[0]);
fclose(fp);
}
2014-10-02 22:45:25 +00:00
return 0;
2014-06-27 16:02:42 +00:00
}