xref: /csrg-svn/sbin/dumplfs/misc.c (revision 68988)
151145Sbostic /*-
261488Sbostic  * Copyright (c) 1991, 1993
361488Sbostic  *	The Regents of the University of California.  All rights reserved.
451145Sbostic  *
551145Sbostic  * %sccs.include.redist.c%
651145Sbostic  */
751145Sbostic 
851145Sbostic #ifndef lint
9*68988Sbostic static char sccsid[] = "@(#)misc.c	8.2 (Berkeley) 04/28/95";
1051145Sbostic #endif /* not lint */
1151145Sbostic 
1251145Sbostic #include <sys/types.h>
13*68988Sbostic 
14*68988Sbostic #include <err.h>
1551145Sbostic #include <errno.h>
16*68988Sbostic #include <stdio.h>
1751145Sbostic #include <stdlib.h>
1851145Sbostic #include <string.h>
19*68988Sbostic #include <unistd.h>
2051145Sbostic #include "extern.h"
2151145Sbostic 
2251145Sbostic void
get(fd,off,p,len)2351145Sbostic get(fd, off, p, len)
2451145Sbostic 	int fd;
2551145Sbostic 	off_t off;
2651145Sbostic 	void *p;
2751145Sbostic 	size_t len;
2851145Sbostic {
2951145Sbostic 	int rbytes;
3051145Sbostic 
3151145Sbostic 	if (lseek(fd, off, SEEK_SET) < 0)
32*68988Sbostic 		err(1, "%s", special);
3351145Sbostic 	if ((rbytes = read(fd, p, len)) < 0)
34*68988Sbostic 		err(1, "%s", special);
3551145Sbostic 	if (rbytes != len)
36*68988Sbostic 		errx(1, "%s: short read (%d, not %d)", special, rbytes, len);
3751145Sbostic }
38