Changeset 3fb0d8 in git
- Timestamp:
- Dec 9, 2010, 3:34:09 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- e8dc78ffa753e2f367da43a0c272e88775f37a3a
- Parents:
- eab7503edc1c1a557464d1ea585d007148087e72
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
reab750 r3fb0d8 22 22 sum(vector/id/..[,v]); add components of vector/ideal/...[with indices v] 23 23 watchdog(i,cmd); only wait for result of command cmd for i seconds 24 which(command); search for command and return absolute path, if found25 24 primecoeffs(J[,q]); primefactors <= min(p,32003) of coeffs of J 26 25 timeStd(i,d) std(i) if the standard basis computation finished … … 925 924 /////////////////////////////////////////////////////////////////////////////// 926 925 927 proc which (command)928 "USAGE: which(command); command = string expression929 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 example933 "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 else949 {950 // unfortunately, it does not take -path951 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 else968 {969 rs = 0;970 }971 i = system("sh", "rm " + fn);972 if (rs == 0) {return (pn);}973 else974 {975 print (command + " not found ");976 return ("");977 }978 }979 example980 { "EXAMPLE:"; echo = 2;981 which("sh");982 }983 ///////////////////////////////////////////////////////////////////////////////984 985 926 proc watchdog(int i, string cmd) 986 927 "USAGE: watchdog(i,cmd); i integer, cmd string
Note: See TracChangeset
for help on using the changeset viewer.