24#include "local_proto.h"
26static int read_int(
int,
int *);
27static int read_off_t(
int, off_t *);
62 if (lseek(fd, 0L, SEEK_SET) < 0) {
70 if (!read_off_t(fd, &SEG->nrows) || !read_off_t(fd, &SEG->ncols) ||
71 !read_int(fd, &SEG->srows) || !read_int(fd, &SEG->scols) ||
72 !read_int(fd, &SEG->len))
78static int read_int(
int fd,
int *n)
82 if ((bytes_read = read(fd, n,
sizeof(
int))) == -1)
83 G_warning(
"read_int: %s", strerror(errno));
85 bytes_read = (bytes_read ==
sizeof(int));
90static int read_off_t(
int fd, off_t *n)
94 if ((bytes_read = read(fd, n,
sizeof(off_t))) == -1)
95 G_warning(
"read_off_t: %s", strerror(errno));
97 bytes_read = (bytes_read ==
sizeof(off_t));
void G_warning(const char *msg,...)
Print a warning message to stderr.
int Segment_init(SEGMENT *SEG, int fd, int nseg)
Initialize segment structure.
int seg_setup(SEGMENT *SEG)
Internal use only.
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)