8
int cseg_open(CSEG * cseg, int srows, int scols, int nsegs_in_memory)
14
cseg->filename = NULL;
19
filename = G_tempfile();
20
if (-1 == (fd = creat(filename, 0666))) {
21
G_warning("cseg_open(): unable to create segment file");
26
segment_format(fd, G_window_rows(), G_window_cols(), srows, scols,
31
G_warning("cseg_open(): could not write segment file");
35
G_warning("cseg_open(): illegal configuration parameter(s)");
40
if (-1 == (fd = open(filename, 2))) {
42
G_warning("cseg_open(): unable to re-open segment file");
45
if (0 > (errflag = segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
49
G_warning("cseg_open(): could not read segment file");
53
G_warning("cseg_open(): out of memory");
57
cseg->filename = filename;