1 /*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 04/28/95";
10 #endif /* not lint */
11
12 #include <sys/types.h>
13
14 #include <err.h>
15 #include <errno.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <unistd.h>
20 #include "extern.h"
21
22 void
get(fd,off,p,len)23 get(fd, off, p, len)
24 int fd;
25 off_t off;
26 void *p;
27 size_t len;
28 {
29 int rbytes;
30
31 if (lseek(fd, off, SEEK_SET) < 0)
32 err(1, "%s", special);
33 if ((rbytes = read(fd, p, len)) < 0)
34 err(1, "%s", special);
35 if (rbytes != len)
36 errx(1, "%s: short read (%d, not %d)", special, rbytes, len);
37 }
38