diff options
Diffstat (limited to 'src/functioncommandtolist.cpp')
| -rw-r--r-- | src/functioncommandtolist.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/functioncommandtolist.cpp b/src/functioncommandtolist.cpp index 46762b5..708db5b 100644 --- a/src/functioncommandtolist.cpp +++ b/src/functioncommandtolist.cpp | |||
| @@ -11,7 +11,58 @@ FunctionCommandToList::~FunctionCommandToList() | |||
| 11 | { | 11 | { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | void FunctionCommandToList::execute( const StringList &lInput, StringList &lOutput ) | 14 | void FunctionCommandToList::execute( Build *bld, const StringList &lInput, StringList &lOutput ) |
| 15 | { | 15 | { |
| 16 | //rView.beginExtraRequiresCheck( s.c_str() ); | ||
| 17 | //rView.executeCmd( s.c_str() ); | ||
| 18 | FILE *fcmd = popen( lParams.front().c_str(), "r" ); | ||
| 19 | std::string rhs; | ||
| 20 | bool bHeader = true; | ||
| 21 | for(;;) | ||
| 22 | { | ||
| 23 | if( feof( fcmd ) ) | ||
| 24 | break; | ||
| 25 | int cc = fgetc( fcmd ); | ||
| 26 | if( cc == EOF ) | ||
| 27 | break; | ||
| 28 | unsigned char c = cc; | ||
| 29 | if( bHeader ) | ||
| 30 | { | ||
| 31 | if( c == ':' ) | ||
| 32 | bHeader = false; | ||
| 33 | } | ||
| 34 | else | ||
| 35 | { | ||
| 36 | if( c == ' ' || c == '\t' ) | ||
| 37 | { | ||
| 38 | if( rhs != "" ) | ||
| 39 | { | ||
| 40 | lOutput.push_back( rhs ); | ||
| 41 | rhs = ""; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | else | ||
| 45 | { | ||
| 46 | if( c == '\\' ) | ||
| 47 | c = fgetc( fcmd ); | ||
| 48 | if( c != '\n' ) | ||
| 49 | rhs += c; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
| 53 | if( rhs != "" ) | ||
| 54 | { | ||
| 55 | lOutput.push_back( rhs ); | ||
| 56 | rhs = ""; | ||
| 57 | } | ||
| 58 | pclose( fcmd ); | ||
| 59 | //rView.endExtraRequiresCheck(); | ||
| 60 | } | ||
| 61 | |||
| 62 | Function *FunctionCommandToList::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | ||
| 63 | { | ||
| 64 | Function *pRet = new FunctionCommandToList(); | ||
| 65 | pRet->copyData( this, bld, cont, mExtra ); | ||
| 66 | return pRet; | ||
| 16 | } | 67 | } |
| 17 | 68 | ||
