383 |
if(fname[0]=='|') |
if(fname[0]=='|') |
384 |
fp = popen(fname+1,"r"); |
fp = popen(fname+1,"r"); |
385 |
else |
else |
386 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
387 |
|
|
388 |
AGAIN: |
AGAIN: |
389 |
if (fp == NULL) { |
if (fp == NULL) { |
390 |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil) |
if (sSAallow_gzipped_fileA->s.s_dbind != sLnil) |
391 |
{ |
{ |
392 |
struct stat ss; |
struct string st; |
393 |
char buf[256]; |
char buf[256]; |
394 |
if (snprintf(buf,sizeof(buf),"%s.gz",fname)<=0) |
if (snprintf(buf,sizeof(buf),"%s.gz",fname)<=0) |
395 |
FEerror("Cannot write .gz filename",0); |
FEerror("Cannot write .gz filename",0); |
396 |
if (!stat(buf,&ss)) { |
st.st_self=buf; |
397 |
|
st.st_dim=st.st_fillp=strlen(buf); |
398 |
|
st.t=t_string; |
399 |
|
if (file_exists((object)&st)) { |
400 |
FILE *pp; |
FILE *pp; |
401 |
int n; |
int n; |
402 |
if (!(fp=tmpfile())) |
if (!(fp=tmpfile())) |
416 |
} |
} |
417 |
} |
} |
418 |
|
|
419 |
/* fp = fopen(buf,"r"); */ |
/* fp = fopen_not_dir(buf,"r"); */ |
420 |
/* if (fp) */ |
/* if (fp) */ |
421 |
/* { */ |
/* { */ |
422 |
/* #ifdef NO_MKSTEMP */ |
/* #ifdef NO_MKSTEMP */ |
437 |
/* fp = 0; */ |
/* fp = 0; */ |
438 |
/* if (0 == system(command)) */ |
/* if (0 == system(command)) */ |
439 |
/* { */ |
/* { */ |
440 |
/* fp = fopen(tmp,"r"); */ |
/* fp = fopen_not_dir(tmp,"r"); */ |
441 |
/* if (fp) */ |
/* if (fp) */ |
442 |
/* goto AGAIN; */ |
/* goto AGAIN; */ |
443 |
/* /\* should not get here *\/ */ |
/* /\* should not get here *\/ */ |
446 |
if (if_does_not_exist == sKerror) |
if (if_does_not_exist == sKerror) |
447 |
cannot_open(fn); |
cannot_open(fn); |
448 |
else if (if_does_not_exist == sKcreate) { |
else if (if_does_not_exist == sKcreate) { |
449 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
450 |
if (fp == NULL) |
if (fp == NULL) |
451 |
cannot_create(fn); |
cannot_create(fn); |
452 |
fclose(fp); |
fclose(fp); |
453 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
454 |
if (fp == NULL) |
if (fp == NULL) |
455 |
cannot_open(fn); |
cannot_open(fn); |
456 |
} else if (if_does_not_exist == Cnil) |
} else if (if_does_not_exist == Cnil) |
462 |
} else if (smm == smm_output || smm == smm_io) { |
} else if (smm == smm_output || smm == smm_io) { |
463 |
if (if_exists == sKnew_version && if_does_not_exist == sKcreate) |
if (if_exists == sKnew_version && if_does_not_exist == sKcreate) |
464 |
goto CREATE; |
goto CREATE; |
465 |
fp = fopen(fname, "r"); |
fp = fopen_not_dir(fname, "r"); |
466 |
if (fp != NULL) { |
if (fp != NULL) { |
467 |
fclose(fp); |
fclose(fp); |
468 |
if (if_exists == sKerror) |
if (if_exists == sKerror) |
478 |
if_exists == sKnew_version || |
if_exists == sKnew_version || |
479 |
if_exists == sKsupersede) { |
if_exists == sKsupersede) { |
480 |
if (smm == smm_output) |
if (smm == smm_output) |
481 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
482 |
else |
else |
483 |
fp = fopen(fname, "w+"); |
fp = fopen_not_dir(fname, "w+"); |
484 |
if (fp == NULL) |
if (fp == NULL) |
485 |
cannot_create(fn); |
cannot_create(fn); |
486 |
} else if (if_exists == sKoverwrite) { |
} else if (if_exists == sKoverwrite) { |
487 |
fp = fopen(fname, "r+"); |
fp = fopen_not_dir(fname, "r+"); |
488 |
if (fp == NULL) |
if (fp == NULL) |
489 |
cannot_open(fn); |
cannot_open(fn); |
490 |
} else if (if_exists == sKappend) { |
} else if (if_exists == sKappend) { |
491 |
if (smm == smm_output) |
if (smm == smm_output) |
492 |
fp = fopen(fname, "a"); |
fp = fopen_not_dir(fname, "a"); |
493 |
else |
else |
494 |
fp = fopen(fname, "a+"); |
fp = fopen_not_dir(fname, "a+"); |
495 |
if (fp == NULL) |
if (fp == NULL) |
496 |
FEerror("Cannot append to the file ~A.",1,fn); |
FEerror("Cannot append to the file ~A.",1,fn); |
497 |
} else if (if_exists == Cnil) |
} else if (if_exists == Cnil) |
509 |
if(fname[0]=='|') |
if(fname[0]=='|') |
510 |
fp = popen(fname+1,"w"); |
fp = popen(fname+1,"w"); |
511 |
else |
else |
512 |
fp = fopen(fname, "w"); |
fp = fopen_not_dir(fname, "w"); |
513 |
} |
} |
514 |
else |
else |
515 |
fp = fopen(fname, "w+"); |
fp = fopen_not_dir(fname, "w+"); |
516 |
if (fp == NULL) |
if (fp == NULL) |
517 |
cannot_create(fn); |
cannot_create(fn); |
518 |
} else if (if_does_not_exist == Cnil) |
} else if (if_does_not_exist == Cnil) |