Used in DB IDO and Livestatus. */
| 18 | |
| 19 | /* Used in DB IDO and Livestatus. */ |
| 20 | String CompatUtility::GetCommandLine(const Command::Ptr& command) |
| 21 | { |
| 22 | Value commandLine = command->GetCommandLine(); |
| 23 | |
| 24 | String result; |
| 25 | if (commandLine.IsObjectType<Array>()) { |
| 26 | Array::Ptr args = commandLine; |
| 27 | |
| 28 | ObjectLock olock(args); |
| 29 | for (String arg : args) { |
| 30 | // This is obviously incorrect for non-trivial cases. |
| 31 | result += " \"" + EscapeString(arg) + "\""; |
| 32 | } |
| 33 | } else if (!commandLine.IsEmpty()) { |
| 34 | result = EscapeString(Convert::ToString(commandLine)); |
| 35 | } else { |
| 36 | result = "<internal>"; |
| 37 | } |
| 38 | |
| 39 | return result; |
| 40 | } |
| 41 | |
| 42 | String CompatUtility::GetCommandNamePrefix(const Command::Ptr& command) |
| 43 | /* Helper. */ |
no test coverage detected