24 #include "local_proto.h"
26 static int read_int(
int,
int *);
27 static 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))
78 static 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));
90 static 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 *,...) __attribute__((format(printf
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)