| 587 | 
  | 
#ifdef getc_unlocked | 
| 588 | 
  | 
        flockfile(fp); | 
| 589 | 
  | 
#endif | 
| 590 | 
< | 
                                                /* complete header */ | 
| 591 | 
< | 
        if (rm->info) | 
| 590 | 
> | 
        if (rm->info)                           /* complete header */ | 
| 591 | 
  | 
                fputs(rm->info, fp); | 
| 592 | 
  | 
        if (dtype == DTfromHeader) | 
| 593 | 
  | 
                dtype = rm->dtype; | 
| 603 | 
  | 
        else if (rm->cexp[GRN] != 1.f) | 
| 604 | 
  | 
                fputexpos(rm->cexp[GRN], fp); | 
| 605 | 
  | 
        if ((dtype != DTrgbe) & (dtype != DTxyze)) { | 
| 606 | 
< | 
                if (dtype == DTspec) { | 
| 608 | 
< | 
                        if (rm->ncomp < 3) | 
| 609 | 
< | 
                                return(0);      /* bad # components */ | 
| 610 | 
< | 
                        fputwlsplit(rm->wlpart, fp); | 
| 611 | 
< | 
                } else { | 
| 606 | 
> | 
                if (dtype != DTspec) { | 
| 607 | 
  | 
                        fprintf(fp, "NROWS=%d\n", rm->nrows); | 
| 608 | 
  | 
                        fprintf(fp, "NCOLS=%d\n", rm->ncols); | 
| 609 | 
< | 
                } | 
| 609 | 
> | 
                } else if (rm->ncomp < 3) | 
| 610 | 
> | 
                        return(0);              /* bad # components */ | 
| 611 | 
  | 
                fputncomp(rm->ncomp, fp); | 
| 612 | 
+ | 
                if (dtype == DTspec || (rm->ncomp > 3 && | 
| 613 | 
+ | 
                                memcmp(rm->wlpart, WLPART, sizeof(WLPART)))) | 
| 614 | 
+ | 
                        fputwlsplit(rm->wlpart, fp); | 
| 615 | 
  | 
        } else if ((rm->ncomp != 3) & (rm->ncomp != 1)) | 
| 616 | 
  | 
                return(0);                      /* wrong # components */ | 
| 617 | 
  | 
        if ((dtype == DTfloat) | (dtype == DTdouble)) | 
| 618 | 
  | 
                fputendian(fp);                 /* important to record */ | 
| 619 | 
  | 
        fputformat(cm_fmt_id[dtype], fp); | 
| 620 | 
< | 
        fputc('\n', fp); | 
| 620 | 
> | 
        fputc('\n', fp);                        /* end of header */ | 
| 621 | 
  | 
        switch (dtype) {                        /* write data */ | 
| 622 | 
  | 
        case DTascii: | 
| 623 | 
  | 
                ok = rmx_write_ascii(rm, fp); |