/[gcl]/gcl/o/file.d
ViewVC logotype

Diff of /gcl/o/file.d

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.42 by camm, Sun May 1 04:12:52 2005 UTC revision 1.43 by camm, Wed May 4 17:40:51 2005 UTC
# Line 381  object if_exists, if_does_not_exist; Line 381  object if_exists, if_does_not_exist;
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()))
# Line 411  object if_exists, if_does_not_exist; Line 414  object if_exists, if_does_not_exist;
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)
# Line 428  object if_exists, if_does_not_exist; Line 431  object if_exists, if_does_not_exist;
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)
# Line 444  object if_exists, if_does_not_exist; Line 447  object if_exists, if_does_not_exist;
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)
# Line 473  object if_exists, if_does_not_exist; Line 476  object if_exists, if_does_not_exist;
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)

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26