Changeset a70441f in git for Singular/LIB/general.lib


Ignore:
Timestamp:
Apr 27, 2000, 12:07:30 PM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
e5f8ae07e0b41bb1b0e5aaaac2dad244e619d563
Parents:
eec9b2d2a332c04f20d743bdd4ccc107766fbc61
Message:
Windows and gcc 2.95 porting


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    reec9b2 ra70441f  
    1 // $Id: general.lib,v 1.25 2000-01-13 12:15:54 obachman Exp $
     1// $Id: general.lib,v 1.26 2000-04-27 10:07:13 obachman Exp $
    22//GMG, last modified 18.6.99
    33///////////////////////////////////////////////////////////////////////////////
    44
    5 version="$Id: general.lib,v 1.25 2000-01-13 12:15:54 obachman Exp $";
     5version="$Id: general.lib,v 1.26 2000-04-27 10:07:13 obachman Exp $";
    66info="
    77LIBRARY:  general.lib   PROCEDURES OF GENERAL TYPE
     
    980980   int rs;
    981981   int i;
    982    string fn = "/tmp/which_" + string(system("pid"));
     982   string fn = "which_" + string(system("pid"));
    983983   string pn;
     984   string cmd;
    984985   if( typeof(command) != "string")
    985986   {
    986987     return (pn);
    987988   }
    988    i = system("sh", "which " + command + " > " + fn);
     989   if (system("uname") != "ix86-Win")
     990   {
     991     cmd = "which ";
     992   }
     993   else
     994   {
     995     // unfortunately, it does not take -path
     996     cmd = "type ";
     997   }
     998   i = system("sh", cmd + command + " > " + fn);
    989999   pn = read(fn);
    990    pn[size(pn)] = "";
    991    i = 1;
    992    while ((pn[i] != " ") and (pn[i] != ""))
    993    {
    994      i = i+1;
    995    }
    996    if (pn[i] == " ") {pn[i] = "";}
    997    rs = system("sh", "ls " + pn + " > " + fn + " 2>&1 ");
     1000   if (system("uname") != "ix86-Win")
     1001   {
     1002     // TBC: Hmm... should parse output to get rid of 'command is '
     1003     pn[size(pn)] = "";
     1004     i = 1;
     1005     while ((pn[i] != " ") and (pn[i] != ""))
     1006     {
     1007       i = i+1;
     1008     }
     1009     if (pn[i] == " ") {pn[i] = "";}
     1010     rs = system("sh", "ls " + pn + " > " + fn + " 2>&1 ");
     1011   }
     1012   else
     1013   {
     1014     rs = 0;
     1015   }
    9981016   i = system("sh", "rm " + fn);
    9991017   if (rs == 0) {return (pn);}
     
    10061024example
    10071025{  "EXAMPLE:"; echo = 2;
    1008     which("Singular");
    1009 }
    1010 ///////////////////////////////////////////////////////////////////////////////
     1026    which("sh");
     1027}
     1028///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.