Changeset 82a884b in git for Singular/febase.cc


Ignore:
Timestamp:
Jan 27, 1998, 3:10:15 PM (26 years ago)
Author:
Wilfred Pohl <pohl@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
1f3f0e80b4082b3102b965bbc5583208d5ba465a
Parents:
10b3a752e88f890c4be07205f527a9623b8284b7
Message:
feFopen for macintosh


git-svn-id: file:///usr/local/Singular/svn/trunk@1083 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/febase.cc

    r10b3a7 r82a884b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.cc,v 1.23 1997-11-18 16:30:52 Singular Exp $ */
     4/* $Id: febase.cc,v 1.24 1998-01-27 14:10:15 pohl Exp $ */
    55/*
    66* ABSTRACT: i/o system
     
    107107{
    108108  FILE * f=fopen(path,mode);
     109#ifdef macintosh
     110  if (f!=NULL)
     111  {
     112    if (where!=NULL) strcpy(where,path);
     113    return f;
     114  }
     115  char *res;
     116  int idat=strlen(SINGULAR_DATADIR),ipath=strlen(path);
     117  char *env=getenv("SINGULARPATH");
     118  int ienv=strlen(env), ii=ienv;
     119  if (ii<idat) ii = idat;
     120  if (ii==0)
     121  {
     122    if (useWerror)
     123      Werror("cannot open `%s`",path);
     124    return f;
     125  }
     126  res=(char*) AllocL(ii+ipath+1);
     127  if (ienv!=0)
     128  {
     129    memcpy(res,env,ienv);
     130    memcpy(res+ienv,path,ipath);
     131    res[ienv+ipath]='\0';
     132    f=fopen(res,mode);
     133  }
     134  if ((f==NULL)&&(idat!=0))
     135  {
     136    memcpy(res,SINGULAR_DATADIR,idat);
     137    memcpy(res+idat,path,ipath);
     138    res[idat+ipath]='\0';
     139    f=fopen(res,mode);
     140  }
     141  if (f==NULL)
     142  {
     143    if (useWerror)
     144      Werror("cannot open `%s`",res);
     145  }
     146  else if (where!=NULL)
     147    strcpy(where,res);
     148  FreeL(res);
     149#else
    109150  if (where!=NULL) strcpy(where,path);
    110151  if ((*mode=='r') && (path[0]!=DIR_SEP)&&(path[0]!='.')
     
    178219  if ((f==NULL)&&(useWerror))
    179220    Werror("cannot open `%s`",path);
     221#endif
    180222  return f;
    181223}
Note: See TracChangeset for help on using the changeset viewer.