Changeset 3fb0d8 in git


Ignore:
Timestamp:
Dec 9, 2010, 3:34:09 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e8dc78ffa753e2f367da43a0c272e88775f37a3a
Parents:
eab7503edc1c1a557464d1ea585d007148087e72
Message:
which removed (tr. 281)

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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    reab750 r3fb0d8  
    2222 sum(vector/id/..[,v]); add components of vector/ideal/...[with indices v]
    2323 watchdog(i,cmd);       only wait for result of command cmd for i seconds
    24  which(command);        search for command and return absolute path, if found
    2524 primecoeffs(J[,q]);    primefactors <= min(p,32003) of coeffs of J
    2625 timeStd(i,d)           std(i) if the standard basis computation finished
     
    925924///////////////////////////////////////////////////////////////////////////////
    926925
    927 proc which (command)
    928 "USAGE:    which(command); command = string expression
    929 RETURN:   Absolute pathname of command, if found in search path.
    930           Empty string, otherwise.
    931 NOTE:     Based on the Unix command 'which'.
    932 EXAMPLE:  example which; shows an example
    933 "
    934 {
    935    int rs;
    936    int i;
    937    string fn = "which_" + string(system("pid"));
    938    string pn;
    939    string cmd;
    940    if( typeof(command) != "string")
    941    {
    942      return (pn);
    943    }
    944    if (system("uname") != "ix86-Win")
    945    {
    946      cmd = "which ";
    947    }
    948    else
    949    {
    950      // unfortunately, it does not take -path
    951      cmd = "type ";
    952    }
    953    i = system("sh", cmd + command + " > " + fn);
    954    pn = read(fn);
    955    if (system("uname") != "ix86-Win")
    956    {
    957      // TBC: Hmm... should parse output to get rid of 'command is '
    958      pn[size(pn)] = "";
    959      i = 1;
    960      while ((pn[i] != " ") and (pn[i] != ""))
    961      {
    962        i = i+1;
    963      }
    964      if (pn[i] == " ") {pn[i] = "";}
    965      rs = system("sh", "ls " + pn + " > " + fn + " 2>&1 ");
    966    }
    967    else
    968    {
    969      rs = 0;
    970    }
    971    i = system("sh", "rm " + fn);
    972    if (rs == 0) {return (pn);}
    973    else
    974    {
    975      print (command + " not found ");
    976      return ("");
    977    }
    978 }
    979 example
    980 {  "EXAMPLE:"; echo = 2;
    981     which("sh");
    982 }
    983 ///////////////////////////////////////////////////////////////////////////////
    984 
    985926proc watchdog(int i, string cmd)
    986927"USAGE:   watchdog(i,cmd); i integer, cmd string
Note: See TracChangeset for help on using the changeset viewer.