Changeset d9e190 in git


Ignore:
Timestamp:
Apr 21, 2011, 4:41:50 PM (13 years ago)
Author:
Mohamed Barakat <mohamed.barakat@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
6d28ba7962ff547926c1a0ce553ff7070a77746e
Parents:
4f07ef5931598da3a05c62cb735d25ecaac0c5a9
git-author:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-04-21 16:41:50+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:27+01:00
Message:
got rid of program_invocation_name (non-portable) and replaced it by an educated guess
changed the test generation script to save a copy of the program name in main
Location:
libpolys
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libpolys/resources/feResource.cc

    r4f07ef rd9e190  
    1010#include <unistd.h>
    1111#include <string.h>
     12#include <unistd.h>
     13#include <sys/param.h>
    1214
    1315#include "config.h"
     
    1517
    1618#include "feResource.h"
    17 
    18 
    19 // the following is needed due to 'program_invocation_name'
    20 #define _GNU_SOURCE
    21 #include <errno.h>
    2219
    2320
     
    179176void feInitResources(char* argv0)
    180177{
    181   if (argv0==NULL)
    182   {
    183     argv0 = program_invocation_name;
    184   }
    185  
    186178#if defined(ix86_Win) && defined(__GNUC__)
    187179  if (cygwin32_posix_path_list_p (getenv("PATH")))
    188180    fePathSep = ':';
    189181#endif
    190   feArgv0 = omStrDup(argv0);
    191 #ifdef RESOURCE_DEBUG
    192   printf("feInitResources: entering with argv0=%s=\n", argv0);
     182  if (argv0==NULL)
     183  {
     184    feArgv0 = (char*)omAlloc0(MAXPATHLEN+strlen("/Singular"));
     185    getcwd(feArgv0,MAXPATHLEN);
     186    strcpy(feArgv0+strlen(feArgv0),"/Singular");
     187  }
     188  else
     189    feArgv0 = omStrDup(argv0);
     190#ifdef RESOURCE_DEBUG
     191  printf("feInitResources: entering with argv0=%s=\n", feArgv0);
    193192#endif
    194193  // init some Resources
  • libpolys/tests/coeffs_test.h

    r4f07ef rd9e190  
    343343    bool setUpWorld() {
    344344      clog << endl << ( "<world>" ) << endl;
    345       feInitResources();
     345      feInitResources(argv0);
    346346      return true;
    347347    }
  • libpolys/tests/cxxtestgen.pl

    r4f07ef rd9e190  
    536536sub writeMain() {
    537537  if ( $gui ) {
     538    print "char* argv0;\n";
    538539    print "int main( int argc, char *argv[] ) {\n";
     540    print "argv0 = argv[0];\n";
    539541    $noStaticInit &&
    540542      print " CxxTest::initialize();\n";
     
    543545  }
    544546  elsif ( $runner ) {
    545     print "int main() {\n";
     547    print "char* argv0;\n";
     548    print "int main( int argc, char *argv[] ) {\n";
     549    print "argv0 = argv[0];\n";
    546550    $noStaticInit &&
    547551      print " CxxTest::initialize();\n";
  • libpolys/tests/polys_test.h

    r4f07ef rd9e190  
    3737    bool setUpWorld() {
    3838      clog << ( "<world>" ) << endl;
    39       feInitResources();
     39      feInitResources(argv0);
    4040     
    4141      TS_ASSERT_EQUALS( nRegister( n_Zp, npInitChar), n_Zp );
Note: See TracChangeset for help on using the changeset viewer.