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

Comparing ray/src/cv/mgflib/parser.c (file contents):
Revision 1.7 by greg, Fri Jun 24 17:15:49 1994 UTC vs.
Revision 1.8 by greg, Sat Jun 25 09:48:03 1994 UTC

# Line 215 | Line 215 | char   *fn;
215  
216          ctx->lineno = 0;
217          if (fn == NULL) {
218 <                ctx->fname = "<stdin>";
218 >                strcpy(ctx->fname, "<stdin>");
219                  ctx->fp = stdin;
220                  ctx->prev = mg_file;
221                  mg_file = ctx;
# Line 227 | Line 227 | char   *fn;
227                  olen = cp - mg_file->fname + 1;
228          else
229                  olen = 0;
230        ctx->fname = (char *)malloc(olen+strlen(fn)+1);
231        if (ctx->fname == NULL)
232                return(MG_EMEM);
230          if (olen)
231                  strcpy(ctx->fname, mg_file->fname);
232          strcpy(ctx->fname+olen, fn);
233          ctx->fp = fopen(ctx->fname, "r");
234 <        if (ctx->fp == NULL) {
238 <                free((MEM_PTR)ctx->fname);
234 >        if (ctx->fp == NULL)
235                  return(MG_ENOFILE);
240        }
236          ctx->prev = mg_file;            /* establish new context */
237          mg_file = ctx;
238          return(MG_OK);
# Line 253 | Line 248 | mg_close()                     /* close input file */
248          if (ctx->fp == stdin)
249                  return;                 /* don't close standard input */
250          fclose(ctx->fp);
256        free((MEM_PTR)ctx->fname);
251   }
252  
253  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines