381 |
if(fname[0]=='|') |
if(fname[0]=='|') |
382 |
fp = popen(fname+1,"r"); |
fp = popen(fname+1,"r"); |
383 |
else |
else |
384 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
385 |
|
|
386 |
if ((fp == NULL) && |
if ((fp == NULL) && |
387 |
(sSAallow_gzipped_fileA->s.s_dbind != sLnil)) { |
(sSAallow_gzipped_fileA->s.s_dbind != sLnil)) { |
388 |
struct stat ss; |
struct string st; |
389 |
char buf[256]; |
char buf[256]; |
390 |
if (snprintf(buf,sizeof(buf),"%s.gz",fname)<=0) |
if (snprintf(buf,sizeof(buf),"%s.gz",fname)<=0) |
391 |
FEerror("Cannot write .gz filename",0); |
FEerror("Cannot write .gz filename",0); |
392 |
if (!stat(buf,&ss)) { |
st.st_self=buf; |
393 |
|
st.st_dim=st.st_fillp=strlen(buf); |
394 |
|
st.t=t_string; |
395 |
|
if (file_exists((object)&st)) { |
396 |
FILE *pp; |
FILE *pp; |
397 |
int n; |
int n; |
398 |
if (!(fp=tmpfile())) |
if (!(fp=tmpfile())) |
414 |
if (if_does_not_exist == sKerror) |
if (if_does_not_exist == sKerror) |
415 |
cannot_open(fn); |
cannot_open(fn); |
416 |
else if (if_does_not_exist == sKcreate) { |
else if (if_does_not_exist == sKcreate) { |
417 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
418 |
if (fp == NULL) |
if (fp == NULL) |
419 |
cannot_create(fn); |
cannot_create(fn); |
420 |
fclose(fp); |
fclose(fp); |
421 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
422 |
if (fp == NULL) |
if (fp == NULL) |
423 |
cannot_open(fn); |
cannot_open(fn); |
424 |
} else if (if_does_not_exist == Cnil) |
} else if (if_does_not_exist == Cnil) |
431 |
if (fname[0] == '|') |
if (fname[0] == '|') |
432 |
fp = NULL; |
fp = NULL; |
433 |
else |
else |
434 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
435 |
if (fp != NULL) { |
if (fp != NULL) { |
436 |
fclose(fp); |
fclose(fp); |
437 |
if (if_exists == sKerror) |
if (if_exists == sKerror) |
447 |
if_exists == sKnew_version || |
if_exists == sKnew_version || |
448 |
if_exists == sKsupersede) { |
if_exists == sKsupersede) { |
449 |
if (smm == smm_output) |
if (smm == smm_output) |
450 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
451 |
else |
else |
452 |
fp = fopen(fname, "w+"); |
fp = fopen_not_dir(fname, "w+"); |
453 |
if (fp == NULL) |
if (fp == NULL) |
454 |
cannot_create(fn); |
cannot_create(fn); |
455 |
} else if (if_exists == sKoverwrite) { |
} else if (if_exists == sKoverwrite) { |
456 |
fp = fopen(fname, "r+"); |
fp = fopen_not_dir(fname, "r+"); |
457 |
if (fp == NULL) |
if (fp == NULL) |
458 |
cannot_open(fn); |
cannot_open(fn); |
459 |
} else if (if_exists == sKappend) { |
} else if (if_exists == sKappend) { |
460 |
if (smm == smm_output) |
if (smm == smm_output) |
461 |
fp = fopen(fname, "a"); |
fp = fopen_not_dir(fname, "a"); |
462 |
else |
else |
463 |
fp = fopen(fname, "a+"); |
fp = fopen_not_dir(fname, "a+"); |
464 |
if (fp == NULL) |
if (fp == NULL) |
465 |
FEerror("Cannot append to the file ~A.",1,fn); |
FEerror("Cannot append to the file ~A.",1,fn); |
466 |
} else if (if_exists == Cnil) |
} else if (if_exists == Cnil) |
476 |
if(fname[0]=='|') |
if(fname[0]=='|') |
477 |
fp = popen(fname+1,"w"); |
fp = popen(fname+1,"w"); |
478 |
else |
else |
479 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
480 |
} else |
} else |
481 |
fp = fopen(fname, "w+"); |
fp = fopen_not_dir(fname, "w+"); |
482 |
if (fp == NULL) |
if (fp == NULL) |
483 |
cannot_create(fn); |
cannot_create(fn); |
484 |
} else if (if_does_not_exist == Cnil) |
} else if (if_does_not_exist == Cnil) |