MCPcopy Create free account
hub / github.com/amule-project/amule / GetCommand

Method GetCommand

src/ExternalConnector.cpp:379–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void CaMuleExternalConnector::GetCommand(const wxString &prompt, char* buffer, size_t buffer_size)
380{
381#ifdef HAVE_LIBREADLINE
382 char *text = readline(unicode2char(prompt + "$ "));
383 if (text && *text &&
384 (m_InputLine == 0 || strcmp(text,m_InputLine) != 0)) {
385 add_history (text);
386 }
387 if (m_InputLine)
388 free(m_InputLine);
389 m_InputLine = text;
390#else
391 Show(prompt + "$ ");
392 const char *text = fgets(buffer, buffer_size, stdin); // == buffer if ok, NULL if eof
393#endif /* HAVE_LIBREADLINE */
394 if ( text ) {
395 size_t len = strlen(text);
396 if (len > buffer_size - 1) {
397 len = buffer_size - 1;
398 }
399 if (buffer != text) {
400 strncpy(buffer, text, len);
401 }
402 buffer[len] = 0;
403 } else {
404 strncpy(buffer, "quit", buffer_size);
405 }
406}
407
408void CaMuleExternalConnector::TextShell(const wxString &prompt)
409{

Callers 1

command_completionFunction · 0.80

Calls 1

unicode2charFunction · 0.50

Tested by

no test coverage detected