Browse Source

Clarify usage of silence in eth/main

Making it global since it's a local variable used in a global way due to
being captured by an exported lamda function.
cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
aab8a3af0f
  1. 15
      eth/main.cpp

15
eth/main.cpp

@ -66,6 +66,8 @@ using namespace dev::eth;
using namespace boost::algorithm; using namespace boost::algorithm;
using dev::eth::Instruction; using dev::eth::Instruction;
static bool g_silence = false;
void interactiveHelp() void interactiveHelp()
{ {
cout cout
@ -595,21 +597,20 @@ int main(int argc, char** argv)
clientName += "/"; clientName += "/";
string logbuf; string logbuf;
bool silence = false;
std::string additional; std::string additional;
g_logPost = [&](std::string const& a, char const*){ g_logPost = [&](std::string const& a, char const*){
if (silence) if (g_silence)
logbuf += a + "\n"; logbuf += a + "\n";
else else
cout << "\r \r" << a << endl << additional << flush; cout << "\r \r" << a << endl << additional << flush;
}; };
auto getPassword = [&](string const& prompt){ auto getPassword = [&](string const& prompt){
auto s = silence; auto s = g_silence;
silence = true; g_silence = true;
cout << endl; cout << endl;
string ret = dev::getPassword(prompt); string ret = dev::getPassword(prompt);
silence = s; g_silence = s;
return ret; return ret;
}; };
auto getAccountPassword = [&](Address const& a){ auto getAccountPassword = [&](Address const& a){
@ -774,11 +775,11 @@ int main(int argc, char** argv)
string l; string l;
while (!g_exit) while (!g_exit)
{ {
silence = false; g_silence = false;
cout << logbuf << "Press Enter" << flush; cout << logbuf << "Press Enter" << flush;
std::getline(cin, l); std::getline(cin, l);
logbuf.clear(); logbuf.clear();
silence = true; g_silence = true;
#if ETH_READLINE #if ETH_READLINE
if (l.size()) if (l.size())

Loading…
Cancel
Save