ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rtcontrib.c
(Generate patch)

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.42 by greg, Wed Apr 5 14:33:34 2006 UTC vs.
Revision 1.46 by greg, Sat Nov 17 06:21:28 2007 UTC

# Line 27 | Line 27 | typedef double DCOLOR[3];              /* double-precision color *
27   /*
28   * The MODCONT structure is used to accumulate ray contributions
29   * for a particular modifier, which may be subdivided into bins
30 < * if binv is non-zero.  If outspec contains a %s in it, this will
30 > * if binv evaluates > 0.  If outspec contains a %s in it, this will
31   * be replaced with the modifier name.  If outspec contains a %d in it,
32   * this will be used to create one output file per bin, otherwise all bins
33   * will be written to the same file, in order.  If the global outfmt
# Line 46 | Line 46 | static void mcfree(void *p) { epfree((*(MODCONT *)p).b
46  
47   LUTAB   modconttab = LU_SINIT(NULL,mcfree);     /* modifier lookup table */
48  
49 #define CNT_UNKNOWN     0               /* unknown record length */
50 #define CNT_PIPE        (-1)            /* output to a pipe */
49   /*
50   * The STREAMOUT structure holds an open FILE pointer and a count of
51 < * the number of RGB triplets per record, or CNT_UNKNOWN (0) if
54 < * unknown or CNT_PIPE (-1) if writing to a command.
51 > * the number of RGB triplets per record, or 0 if unknown.
52   */
53   typedef struct {
54          FILE            *ofp;           /* output file pointer */
55 +        int             outpipe;        /* output is to a pipe */
56          int             reclen;         /* triplets/record */
57 +        int             xr, yr;         /* output resolution for picture */
58   } STREAMOUT;
59  
60   /* close output stream and free record */
# Line 64 | Line 63 | closestream(void *p)
63   {
64          STREAMOUT       *sop = (STREAMOUT *)p;
65          int             status;
66 <        if (sop->reclen == CNT_PIPE)
66 >        if (sop->outpipe)
67                  status = pclose(sop->ofp);
68          else
69                  status = fclose(sop->ofp);
# Line 81 | Line 80 | LUTAB  ofiletab = LU_SINIT(free,closestream);  /* output
80   STREAMOUT *getostream(const char *ospec, const char *mname, int bn, int noopen);
81   int ofname(char *oname, const char *ospec, const char *mname, int bn);
82   void printheader(FILE *fout, const char *info);
83 < void printresolu(FILE *fout);
83 > void printresolu(FILE *fout, int xr, int yr);
84  
85   /*
86   * The rcont structure is used to manage i/o with a particular
# Line 115 | Line 114 | struct rtproc  rt0;                    /* head of rtrace process list */
114  
115   struct rtproc   *rt_unproc = NULL;      /* unprocessed ray trees */
116  
117 < char    persistfn[] = "pfXXXXXX";       /* persist file name */
117 > #define PERSIST_NONE    0               /* no persist file */
118 > #define PERSIST_SINGLE  1               /* user set -P persist */
119 > #define PERSIST_PARALL  2               /* user set -PP persist */
120 > #define PERSIST_OURS    3               /* -PP persist belongs to us */
121 > int     persist_state = PERSIST_NONE;   /* persist file state */
122 > char    persistfn[] = "pfXXXXXX";       /* our persist file name, if set */
123  
124   int             gargc;                  /* global argc */
125   char            **gargv;                /* global argv */
# Line 127 | Line 131 | int            inpfmt = 'a';           /* input format */
131   int             outfmt = 'a';           /* output format */
132  
133   int             header = 1;             /* output header? */
134 + int             accumulate = 0;         /* accumulate ray values? */
135   int             force_open = 0;         /* truncate existing output? */
136 + int             recover = 0;            /* recover previous output? */
137   int             xres = 0;               /* horiz. output resolution */
138   int             yres = 0;               /* vert. output resolution */
139  
# Line 150 | Line 156 | void addmodfile(char *fname, char *outf, char *binv, i
156  
157   void init(int np);
158   int done_rprocs(struct rtproc *rtp);
159 + void reload_output(void);
160   void recover_output(FILE *fin);
161   void trace_contribs(FILE *fin);
162   struct rtproc *wait_rproc(void);
# Line 214 | Line 221 | main(int argc, char *argv[])
221   {
222          int     contrib = 0;
223          int     nprocs = 1;
217        int     recover = 0;
224          char    *curout = NULL;
225          char    *binval = NULL;
226          int     bincnt = 0;
# Line 268 | Line 274 | main(int argc, char *argv[])
274                                          continue;
275                                  }
276                                  break;
277 +                        case 'c':               /* accumulate ray values */
278 +                                switch (argv[i][2]) {
279 +                                case '\0':
280 +                                        accumulate = !accumulate;
281 +                                        continue;
282 +                                case '+': case '1':
283 +                                case 'T': case 't':
284 +                                case 'Y': case 'y':
285 +                                        accumulate = 1;
286 +                                        continue;
287 +                                case '-': case '0':
288 +                                case 'F': case 'f':
289 +                                case 'N': case 'n':
290 +                                        accumulate = 0;
291 +                                        continue;
292 +                                }
293 +                                break;
294                          case 'r':               /* recover output */
295                                  if (argv[i][2]) break;
296 <                                recover++;
296 >                                recover = 1;
297                                  continue;
298                          case 'h':               /* output header? */
299                                  switch (argv[i][2]) {
# Line 305 | Line 328 | main(int argc, char *argv[])
328                                          continue;
329                                  }
330                                  if (argv[i][2] == 'o') {
331 <                                        force_open++;
331 >                                        force_open = 1;
332                                          continue;
333                                  }
334                                  setformat(argv[i]+2);
# Line 348 | Line 371 | main(int argc, char *argv[])
371                                  addmodfile(argv[i], curout, binval, bincnt);
372                                  continue;
373                          case 'P':               /* persist file */
374 <                                error(USER, "persist file is automatic");
375 <                                break;
374 >                                if (i >= argc-2) break;
375 >                                persist_state = (argv[i][2] == 'P') ?
376 >                                                PERSIST_PARALL : PERSIST_SINGLE;
377 >                                rtargv[rtargc++] = argv[i];
378 >                                rtargv[rtargc++] = argv[++i];
379 >                                continue;
380                          }
381                  rtargv[rtargc++] = argv[i];     /* assume rtrace option */
382          }
383 +        if (accumulate)         /* no output flushing for single record */
384 +                xres = yres = 0;
385                                  /* set global argument list */
386          gargc = argc; gargv = argv;
387                                  /* add "mandatory" rtrace settings */
# Line 366 | Line 395 | main(int argc, char *argv[])
395                  printf("-n  %-2d\t\t\t\t# number of processes\n", nprocs);
396                  printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-',
397                                  contrib ? "contributions" : "coefficients");
398 +                printf("-c%c\t\t\t\t# %s\n", accumulate ? '+' : '-',
399 +                                accumulate ? "accumulate ray values" :
400 +                                        "one output record per ray");
401                  fflush(stdout);                 /* report OUR options */
402                  rtargv[rtargc++] = header ? "-h+" : "-h-";
403                  sprintf(fmt, "-f%c%c", inpfmt, outfmt);
# Line 389 | Line 421 | main(int argc, char *argv[])
421                  exit(1);
422          }
423          if (nprocs > 1) {       /* add persist file if parallel */
424 <                rtargv[rtargc++] = "-PP";
425 <                rtargv[rtargc++] = mktemp(persistfn);
424 >                if (persist_state == PERSIST_SINGLE)
425 >                        error(USER, "use -PP option for multiple processes");
426 >                if (persist_state == PERSIST_NONE) {
427 >                        rtargv[rtargc++] = "-PP";
428 >                        rtargv[rtargc++] = mktemp(persistfn);
429 >                        persist_state = PERSIST_OURS;
430 >                }
431          }
432                                  /* add format string */
433          sprintf(fmt, "-f%cf", inpfmt);
# Line 400 | Line 437 | main(int argc, char *argv[])
437                  error(USER, "missing octree argument");
438          rtargv[rtargc++] = octree = argv[i];
439          rtargv[rtargc] = NULL;
440 <                                /* start rtrace */
440 >                                /* start rtrace & recover if requested */
441          init(nprocs);
442 <        if (recover)            /* perform recovery if requested */
443 <                recover_output(stdin);
444 <        trace_contribs(stdin);  /* compute contributions */
442 >                                /* compute contributions */
443 >        trace_contribs(stdin);
444 >                                /* clean up */
445          quit(0);
446   }
447  
# Line 450 | Line 487 | quit(int status)
487   {
488          int     rtstat;
489  
490 <        if (rt0.next != NULL)           /* terminate persistent rtrace */
490 >        if (persist_state == PERSIST_OURS)  /* terminate waiting rtrace */
491                  killpersist();
492                                          /* clean up rtrace process(es) */
493          rtstat = done_rprocs(&rt0);
# Line 518 | Line 555 | init(int np)
555          } else
556                  raysleft = 0;
557          waitflush = xres;
558 +        if (!recover)
559 +                return;
560 +                                        /* recover previous values */
561 +        if (accumulate)
562 +                reload_output();
563 +        else
564 +                recover_output(stdin);
565   }
566  
567   /* grow modifier to accommodate more bins */
# Line 567 | Line 611 | addmodifier(char *modn, char *outf, char *binv, int bi
611                  mp = growmodifier(mp, bincnt);
612          lep->data = (char *)mp;
613                                          /* allocate output streams */
614 <        for (i = outf==NULL || outf[0]=='!' ? 0 : bincnt; i-- > 0; )
614 >        for (i = bincnt; i-- > 0; )
615                  getostream(mp->outspec, mp->modname, i, 1);
616          return mp;
617   }
# Line 688 | Line 732 | printheader(FILE *fout, const char *info)
732  
733   /* write resolution string to given output stream */
734   void
735 < printresolu(FILE *fout)
735 > printresolu(FILE *fout, int xr, int yr)
736   {
737 <        if (xres > 0) {
738 <                if (yres > 0)                   /* resolution string */
739 <                        fprtresolu(xres, yres, fout);
737 >        if ((xr > 0) & (yr > 0))        /* resolution string */
738 >                fprtresolu(xr, yr, fout);
739 >        if (xres > 0)                   /* global flush flag */
740                  fflush(fout);
697        }
741   }
742  
743   /* Get output stream pointer (open and write header if new and noopen==0) */
744   STREAMOUT *
745   getostream(const char *ospec, const char *mname, int bn, int noopen)
746   {
747 +        static const DCOLOR     nocontrib = BLKCOLOR;
748          static STREAMOUT        stdos;
749          int                     ofl;
750          char                    oname[1024];
# Line 709 | Line 753 | getostream(const char *ospec, const char *mname, int b
753          
754          if (ospec == NULL) {                    /* use stdout? */
755                  if (!noopen && !using_stdout) {
712                        stdos.reclen = 0;
756                          if (outfmt != 'a')
757                                  SET_FILE_BINARY(stdout);
758                          if (header)
759                                  printheader(stdout, NULL);
760 <                        printresolu(stdout);
760 >                        printresolu(stdout, xres, yres);
761 >                        stdos.xr = xres; stdos.yr = yres;
762                          using_stdout = 1;
763                  }
764                  stdos.ofp = stdout;
# Line 734 | Line 778 | getostream(const char *ospec, const char *mname, int b
778                  sop = (STREAMOUT *)malloc(sizeof(STREAMOUT));
779                  if (sop == NULL)
780                          error(SYSTEM, "out of memory in getostream");
781 <                sop->reclen = oname[0] == '!' ? CNT_PIPE : CNT_UNKNOWN;
781 >                sop->outpipe = oname[0] == '!';
782 >                sop->reclen = 0;
783                  sop->ofp = NULL;                /* open iff noopen==0 */
784 +                sop->xr = xres; sop->yr = yres;
785                  lep->data = (char *)sop;
786 +                if (!sop->outpipe & !force_open & !recover &&
787 +                                access(oname, F_OK) == 0) {
788 +                        errno = EEXIST;         /* file exists */
789 +                        goto openerr;
790 +                }
791          }
792          if (!noopen && sop->ofp == NULL) {      /* open output stream */
793                  long            i;
794                  if (oname[0] == '!')            /* output to command */
795                          sop->ofp = popen(oname+1, "w");
796 <                else if (!force_open && access(oname, F_OK) == 0)
746 <                        errno = EEXIST;         /* file exists */
747 <                else                            /* else open it */
796 >                else                            /* else open file */
797                          sop->ofp = fopen(oname, "w");
798 <                if (sop->ofp == NULL) {
799 <                        sprintf(errmsg, "cannot open '%s' for writing", oname);
751 <                        error(SYSTEM, errmsg);
752 <                }
798 >                if (sop->ofp == NULL)
799 >                        goto openerr;
800                  if (outfmt != 'a')
801                          SET_FILE_BINARY(sop->ofp);
802                  if (header) {
# Line 766 | Line 813 | getostream(const char *ospec, const char *mname, int b
813                          *cp = '\0';
814                          printheader(sop->ofp, info);
815                  }
816 <                printresolu(sop->ofp);
816 >                printresolu(sop->ofp, sop->xr, sop->yr);
817                                                  /* play catch-up */
818 <                for (i = sop->reclen > 1 ? sop->reclen*lastdone : lastdone;
819 <                                                                i--; ) {
820 <                        static const DCOLOR     nocontrib = BLKCOLOR;
821 <                        put_contrib(nocontrib, sop->ofp);
818 >                for (i = accumulate ? 0 : lastdone; i--; ) {
819 >                        int     j = sop->reclen;
820 >                        if (j <= 0) j = 1;
821 >                        while (j--)
822 >                                put_contrib(nocontrib, sop->ofp);
823                          if (outfmt == 'a')
824                                  putc('\n', sop->ofp);
825                  }
826                  if (xres > 0)
827                          fflush(sop->ofp);
828          }
829 <        if (sop->reclen != CNT_PIPE)            /* add to length if noopen */
830 <                sop->reclen += noopen;
831 <        return sop;                             /* return open stream */
829 >        sop->reclen += noopen;                  /* add to length if noopen */
830 >        return sop;                             /* return output stream */
831 > openerr:
832 >        sprintf(errmsg, "cannot open '%s' for writing", oname);
833 >        error(SYSTEM, errmsg);
834 >        return NULL;    /* pro forma return */
835   }
836  
837   /* read input ray into buffer */
838   int
839   getinp(char *buf, FILE *fp)
840   {
841 <        double  dv[3];
842 <        float   fv[3];
841 >        double  dv[3], *dvp;
842 >        float   *fvp;
843          char    *cp;
844          int     i;
845  
# Line 812 | Line 863 | getinp(char *buf, FILE *fp)
863          case 'f':
864                  if (fread(buf, sizeof(float), 6, fp) < 6)
865                          return -1;
866 <                memcpy(fv, buf+3*sizeof(float), 3*sizeof(float));
867 <                if (DOT(fv,fv) <= FTINY*FTINY)
866 >                fvp = (float *)buf + 3;
867 >                if (DOT(fvp,fvp) <= FTINY*FTINY)
868                          return 0;       /* dummy ray */
869                  return sizeof(float)*6;
870          case 'd':
871                  if (fread(buf, sizeof(double), 6, fp) < 6)
872                          return -1;
873 <                memcpy(dv, buf+3*sizeof(double), 3*sizeof(double));
874 <                if (DOT(dv,dv) <= FTINY*FTINY)
873 >                dvp = (double *)buf + 3;
874 >                if (DOT(dvp,dvp) <= FTINY*FTINY)
875                          return 0;       /* dummy ray */
876                  return sizeof(double)*6;
877          }
# Line 889 | Line 940 | put_contrib(const DCOLOR cnt, FILE *fout)
940                  fprintf(fout, "%.6e\t%.6e\t%.6e\t", cnt[0], cnt[1], cnt[2]);
941                  break;
942          case 'f':
943 <                fv[0] = cnt[0];
893 <                fv[1] = cnt[1];
894 <                fv[2] = cnt[2];
943 >                copycolor(fv, cnt);
944                  fwrite(fv, sizeof(float), 3, fout);
945                  break;
946          case 'd':
# Line 906 | Line 955 | put_contrib(const DCOLOR cnt, FILE *fout)
955          }
956   }
957  
958 < /* output ray tallies and clear for next primary */
958 > /* output ray tallies and clear for next accumulation */
959   void
960   done_contrib(void)
961   {
# Line 926 | Line 975 | done_contrib(void)
975                          for (j = 1; j < mp->nbins; j++)
976                                  put_contrib(mp->cbin[j],
977                                      getostream(mp->outspec,mp->modname,j,0)->ofp);
978 <                                                /* clear for next ray tree */
978 >                                                /* clear for next time */
979                  memset(mp->cbin, 0, sizeof(DCOLOR)*mp->nbins);
980          }
981          --waitflush;                            /* terminate records */
# Line 999 | Line 1048 | process_queue(void)
1048                          cp += sizeof(float)*9; n -= sizeof(float)*9;
1049                          add_contrib(modname);
1050                  }
1051 <                done_contrib();         /* sum up contributions & output */
1051 >                if (!accumulate)
1052 >                        done_contrib(); /* sum up contributions & output */
1053                  lastdone = rtp->raynum;
1054                  if (rtp->buf != NULL)   /* free up buffer space */
1055                          free(rtp->buf);
# Line 1114 | Line 1164 | trace_contribs(FILE *fin)
1164          }
1165          while (wait_rproc() != NULL)            /* process outstanding rays */
1166                  process_queue();
1167 +        if (accumulate)
1168 +                done_contrib();                 /* output tallies */
1169          if (raysleft)
1170                  error(USER, "unexpected EOF on input");
1171          lu_done(&ofiletab);                     /* close output files */
1172   }
1173  
1174 + /* get ray contribution from previous file */
1175 + static int
1176 + get_contrib(DCOLOR cnt, FILE *finp)
1177 + {
1178 +        COLOR   fv;
1179 +        COLR    cv;
1180 +
1181 +        switch (outfmt) {
1182 +        case 'a':
1183 +                return(fscanf(finp,"%lf %lf %lf",&cnt[0],&cnt[1],&cnt[2]) == 3);
1184 +        case 'f':
1185 +                if (fread(fv, sizeof(fv[0]), 3, finp) != 3)
1186 +                        return(0);
1187 +                copycolor(cnt, fv);
1188 +                return(1);
1189 +        case 'd':
1190 +                return(fread(cnt, sizeof(cnt[0]), 3, finp) == 3);
1191 +        case 'c':
1192 +                if (fread(cv, sizeof(cv), 1, finp) != 1)
1193 +                        return(0);
1194 +                colr_color(fv, cv);
1195 +                copycolor(cnt, fv);
1196 +                return(1);
1197 +        default:
1198 +                error(INTERNAL, "botched output format");
1199 +        }
1200 +        return(0);      /* pro forma return */
1201 + }
1202 +
1203 + /* close output file opened for input */
1204 + static int
1205 + myclose(const LUENT *e, void *p)
1206 + {
1207 +        STREAMOUT       *sop = (STREAMOUT *)e->data;
1208 +        
1209 +        if (sop->ofp == NULL)
1210 +                return;
1211 +        fclose(sop->ofp);
1212 +        sop->ofp = NULL;
1213 + }
1214 +
1215 + /* load previously accumulated values */
1216 + void
1217 + reload_output(void)
1218 + {
1219 +        int             i, j;
1220 +        MODCONT         *mp;
1221 +        int             ofl;
1222 +        char            oname[1024];
1223 +        char            *fmode = "rb";
1224 +        char            *outvfmt;
1225 +        LUENT           *ment, *oent;
1226 +        int             xr, yr;
1227 +        STREAMOUT       sout;
1228 +        DCOLOR          rgbv;
1229 +
1230 +        switch (outfmt) {
1231 +        case 'a':
1232 +                outvfmt = "ascii";
1233 +                fmode = "r";
1234 +                break;
1235 +        case 'f':
1236 +                outvfmt = "float";
1237 +                break;
1238 +        case 'd':
1239 +                outvfmt = "double";
1240 +                break;
1241 +        case 'c':
1242 +                outvfmt = COLRFMT;
1243 +                break;
1244 +        default:
1245 +                error(INTERNAL, "botched output format");
1246 +                return;
1247 +        }
1248 +                                                /* reload modifier values */
1249 +        for (i = 0; i < nmods; i++) {
1250 +                ment = lu_find(&modconttab,modname[i]);
1251 +                mp = (MODCONT *)ment->data;
1252 +                if (mp->outspec == NULL)
1253 +                        error(USER, "cannot reload from stdout");
1254 +                if (mp->outspec[0] == '!')
1255 +                        error(USER, "cannot reload from command");
1256 +                for (j = 0; ; j++) {            /* load each modifier bin */
1257 +                        ofl = ofname(oname, mp->outspec, mp->modname, j);
1258 +                        if (ofl < 0)
1259 +                                error(USER, "bad output file specification");
1260 +                        oent = lu_find(&ofiletab, oname);
1261 +                        if (oent->data != NULL) {
1262 +                                sout = *(STREAMOUT *)oent->data;
1263 +                        } else {
1264 +                                sout.reclen = 0;
1265 +                                sout.outpipe = 0;
1266 +                                sout.xr = xres; sout.yr = yres;
1267 +                                sout.ofp = NULL;
1268 +                        }
1269 +                        if (sout.ofp == NULL) { /* open output as input */
1270 +                                sout.ofp = fopen(oname, fmode);
1271 +                                if (sout.ofp == NULL) {
1272 +                                        if (j)
1273 +                                                break;  /* assume end of modifier */
1274 +                                        sprintf(errmsg, "missing reload file '%s'",
1275 +                                                        oname);
1276 +                                        error(WARNING, errmsg);
1277 +                                        break;
1278 +                                }
1279 +                                if (header && checkheader(sout.ofp, outvfmt, NULL) != 1) {
1280 +                                        sprintf(errmsg, "format mismatch for '%s'",
1281 +                                                        oname);
1282 +                                        error(USER, errmsg);
1283 +                                }
1284 +                                if ((sout.xr > 0) & (sout.yr > 0) &&
1285 +                                                (!fscnresolu(&xr, &yr, sout.ofp) ||
1286 +                                                        xr != sout.xr ||
1287 +                                                        yr != sout.yr)) {
1288 +                                        sprintf(errmsg, "resolution mismatch for '%s'",
1289 +                                                        oname);
1290 +                                        error(USER, errmsg);
1291 +                                }
1292 +                        }
1293 +                        if (oent->key == NULL)  /* new file entry */
1294 +                                oent->key = strcpy((char *)
1295 +                                                malloc(strlen(oname)+1), oname);
1296 +                        if (oent->data == NULL)
1297 +                                oent->data = (char *)malloc(sizeof(STREAMOUT));
1298 +                        *(STREAMOUT *)oent->data = sout;
1299 +                                                        /* read in RGB value */
1300 +                        if (!get_contrib(rgbv, sout.ofp)) {
1301 +                                if (!j)
1302 +                                        break;          /* ignore empty file */
1303 +                                if (j && j < mp->nbins) {
1304 +                                        sprintf(errmsg, "missing data in '%s'",
1305 +                                                        oname);
1306 +                                        error(USER, errmsg);
1307 +                                }
1308 +                                break;
1309 +                        }
1310 +                        if (j >= mp->nbins)             /* grow modifier size */
1311 +                                ment->data = (char *)(mp = growmodifier(mp, j+1));
1312 +                        copycolor(mp->cbin[j], rgbv);
1313 +                }
1314 +        }
1315 +        lu_doall(&ofiletab, myclose, NULL);     /* close all files */
1316 + }
1317 +
1318   /* seek on the given output file */
1319   static int
1320   myseeko(const LUENT *e, void *p)
# Line 1132 | Line 1328 | myseeko(const LUENT *e, void *p)
1328                  sprintf(errmsg, "seek error on file '%s'", e->key);
1329                  error(SYSTEM, errmsg);
1330          }
1331 +        return 0;
1332   }
1333  
1334   /* recover output if possible */
# Line 1186 | Line 1383 | recover_output(FILE *fin)
1383                          if (oent->data != NULL) {
1384                                  sout = *(STREAMOUT *)oent->data;
1385                          } else {
1386 <                                sout.reclen = CNT_UNKNOWN;
1386 >                                sout.reclen = 0;
1387 >                                sout.outpipe = 0;
1388 >                                sout.xr = xres; sout.yr = yres;
1389                                  sout.ofp = NULL;
1390                          }
1391                          if (sout.ofp != NULL) { /* already open? */
# Line 1201 | Line 1400 | recover_output(FILE *fin)
1400                                          break;  /* assume end of modifier */
1401                                  sprintf(errmsg, "missing recover file '%s'",
1402                                                  oname);
1403 <                                error(USER, errmsg);
1403 >                                error(WARNING, errmsg);
1404 >                                break;
1405                          }
1406                          nvals = lseek(fileno(sout.ofp), 0, SEEK_END);
1407                          if (nvals <= 0) {
# Line 1209 | Line 1409 | recover_output(FILE *fin)
1409                                  fclose(sout.ofp);
1410                                  break;
1411                          }
1412 <                        if (sout.reclen == CNT_UNKNOWN) {
1412 >                        if (!sout.reclen) {
1413                                  if (!(ofl & OF_BIN)) {
1414                                          sprintf(errmsg,
1415                                                  "need -bn to recover file '%s'",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines