23 #include <grass/segment.h>
26 static int read_int(
int,
int *);
62 if (lseek(fd, 0L, SEEK_SET) < 0) {
68 if (!read_int(fd, &SEG->nrows)
69 || !read_int(fd, &SEG->ncols)
70 || !read_int(fd, &SEG->srows)
71 || !read_int(fd, &SEG->scols)
72 || !read_int(fd, &SEG->len))
79 static int read_int(
int fd,
int *n)
83 if ((bytes_read = read(fd, n,
sizeof(
int))) == -1)
84 G_warning(
"read_int: %s", strerror(errno));
86 bytes_read = (bytes_read ==
sizeof(int));