aboutsummaryrefslogtreecommitdiff
path: root/src/functiongetmakedeps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/functiongetmakedeps.cpp')
-rw-r--r--src/functiongetmakedeps.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/functiongetmakedeps.cpp b/src/functiongetmakedeps.cpp
index fda6aa2..22cf4aa 100644
--- a/src/functiongetmakedeps.cpp
+++ b/src/functiongetmakedeps.cpp
@@ -8,7 +8,7 @@ using namespace Bu;
8 8
9#include <bu/plugger.h> 9#include <bu/plugger.h>
10PluginInterface3( pluginFunctionGetMakeDeps, getMakeDeps, FunctionGetMakeDeps, 10PluginInterface3( pluginFunctionGetMakeDeps, getMakeDeps, FunctionGetMakeDeps,
11 Function, "Mike Buland", 0, 1 ); 11 Function, "Mike Buland", 0, 1 );
12 12
13FunctionGetMakeDeps::FunctionGetMakeDeps() 13FunctionGetMakeDeps::FunctionGetMakeDeps()
14{ 14{
@@ -20,50 +20,50 @@ FunctionGetMakeDeps::~FunctionGetMakeDeps()
20 20
21Bu::String FunctionGetMakeDeps::getName() const 21Bu::String FunctionGetMakeDeps::getName() const
22{ 22{
23 return "getMakeDeps"; 23 return "getMakeDeps";
24} 24}
25 25
26Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams ) 26Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams )
27{ 27{
28 pContext->getView()->cmdStarted( lParams.first().getString().getStr() ); 28 pContext->getView()->cmdStarted( lParams.first().getString().getStr() );
29 Process p( Process::StdOut, "/bin/bash", "/bin/bash", "-c", 29 Process p( Process::StdOut, "/bin/bash", "/bin/bash", "-c",
30 lParams.first().getString().getStr(), NULL ); 30 lParams.first().getString().getStr(), NULL );
31 31
32 // Gather all data from the command. 32 // Gather all data from the command.
33 Bu::String sBuf; 33 Bu::String sBuf;
34 do 34 do
35 { 35 {
36 char buf[4096]; 36 char buf[4096];
37 int iRead = p.read( buf, 4096 ); 37 int iRead = p.read( buf, 4096 );
38 sBuf.append( buf, iRead ); 38 sBuf.append( buf, iRead );
39 } 39 }
40 while( !p.isEos() ); 40 while( !p.isEos() );
41 41
42 pContext->getView()->cmdFinished( "", "", p.childExitStatus() ); 42 pContext->getView()->cmdFinished( "", "", p.childExitStatus() );
43 43
44 Variable vRet( Variable::typeList ); 44 Variable vRet( Variable::typeList );
45 45
46 Bu::String::iterator i, j; 46 Bu::String::iterator i, j;
47 i = sBuf.find(':')+2; 47 i = sBuf.find(':')+2;
48 while( i ) 48 while( i )
49 { 49 {
50 // Find whitespace at the end of the word, this one is easy, there's 50 // Find whitespace at the end of the word, this one is easy, there's
51 // always a space after a word 51 // always a space after a word
52 for( j = i; j && *j != ' ' && *j != '\n' && *j != '\r'; j++ ) { } 52 for( j = i; j && *j != ' ' && *j != '\n' && *j != '\r'; j++ ) { }
53 53
54 Bu::String sTmp( i, j ); 54 Bu::String sTmp( i, j );
55 vRet.append( sTmp ); 55 vRet.append( sTmp );
56 56
57 // Find the begining of the next word, trickier, we don't want to go 57 // Find the begining of the next word, trickier, we don't want to go
58 // off the end, and we need to skip \ chars at the ends of lines, right 58 // off the end, and we need to skip \ chars at the ends of lines, right
59 // now this is too stupid to do that, so it may not work on windows. 59 // now this is too stupid to do that, so it may not work on windows.
60 // TODO: perhaps make this only skip \ chars at the ends of lines, 60 // TODO: perhaps make this only skip \ chars at the ends of lines,
61 // we'll see if it matters. 61 // we'll see if it matters.
62 for( i = j+1; 62 for( i = j+1;
63 i && (*i == ' ' || *i == '\\' || *i == '\n' || *i == '\r'); i++ ) 63 i && (*i == ' ' || *i == '\\' || *i == '\n' || *i == '\r'); i++ )
64 { } 64 { }
65 } 65 }
66 66
67 return vRet; 67 return vRet;
68} 68}
69 69