summaryrefslogtreecommitdiffstats
path: root/src/CLI/CLI.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-18 17:32:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-18 17:32:01 +0200
commit64be7b89afc0822cf24aeeec588ff5f5af5fe8b4 (patch)
tree0edaf0823e11980d2040e6f2a8c837e35dc313ff /src/CLI/CLI.cpp
parentad8ac022a2ea7a73ecad1034cf9103d2e1bf2779 (diff)
downloadabrt-64be7b89afc0822cf24aeeec588ff5f5af5fe8b4.tar.gz
abrt-64be7b89afc0822cf24aeeec588ff5f5af5fe8b4.tar.xz
abrt-64be7b89afc0822cf24aeeec588ff5f5af5fe8b4.zip
remove a few C++-isms where they did not buy any convenience anyway
text data bss dec hex filename 182372 2624 2320 187316 2dbb4 abrt.t2/abrt-0.0.8.5/src/Daemon/.libs/abrtd 180635 2584 1968 185187 2d363 abrt.t3/abrt-0.0.8.5/src/Daemon/.libs/abrtd 34110 1340 768 36218 8d7a abrt.t2/abrt-0.0.8.5/src/CLI/.libs/abrt-cli 30202 1292 224 31718 7be6 abrt.t3/abrt-0.0.8.5/src/CLI/.libs/abrt-cli 22116 1688 376 24180 5e74 abrt.t2/abrt-0.0.8.5/src/Applet/.libs/abrt-applet 21254 1648 88 22990 59ce abrt.t3/abrt-0.0.8.5/src/Applet/.libs/abrt-applet Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/CLI/CLI.cpp')
-rw-r--r--src/CLI/CLI.cpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp
index f16811e7..1fd09301 100644
--- a/src/CLI/CLI.cpp
+++ b/src/CLI/CLI.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
#include <getopt.h>
#include "ABRTException.h"
#include "ABRTSocket.h"
@@ -18,20 +17,29 @@ enum
static DBusConnection* s_dbus_conn;
-static void print_crash_infos(const vector_crash_infos_t& pCrashInfos, int pMode)
+static void print_crash_infos(vector_crash_infos_t& pCrashInfos, int pMode)
{
unsigned int ii;
for (ii = 0; ii < pCrashInfos.size(); ii++)
{
- if (pCrashInfos[ii].find(CD_REPORTED)->second[CD_CONTENT] != "1" || pMode == GET_LIST_FULL)
+ map_crash_info_t& info = pCrashInfos[ii];
+ if (pMode == GET_LIST_FULL || info.find(CD_REPORTED)->second[CD_CONTENT] != "1")
{
- std::cout << ii << ".\n";
- std::cout << "\tUID : " << pCrashInfos[ii].find(CD_UID)->second[CD_CONTENT] << std::endl;
- std::cout << "\tUUID : " << pCrashInfos[ii].find(CD_UUID)->second[CD_CONTENT] << std::endl;
- std::cout << "\tPackage : " << pCrashInfos[ii].find(CD_PACKAGE)->second[CD_CONTENT] << std::endl;
- std::cout << "\tExecutable: " << pCrashInfos[ii].find(CD_EXECUTABLE)->second[CD_CONTENT] << std::endl;
- std::cout << "\tCrash time: " << pCrashInfos[ii].find(CD_TIME)->second[CD_CONTENT] << std::endl;
- std::cout << "\tCrash Rate: " << pCrashInfos[ii].find(CD_COUNT)->second[CD_CONTENT] << std::endl;
+ printf("%u.\n"
+ "\tUID : %s\n"
+ "\tUUID : %s\n"
+ "\tPackage : %s\n"
+ "\tExecutable: %s\n"
+ "\tCrash time: %s\n"
+ "\tCrash Rate: %s\n",
+ ii,
+ info[CD_UID][CD_CONTENT].c_str(),
+ info[CD_UUID][CD_CONTENT].c_str(),
+ info[CD_PACKAGE][CD_CONTENT].c_str(),
+ info[CD_EXECUTABLE][CD_CONTENT].c_str(),
+ info[CD_TIME][CD_CONTENT].c_str(),
+ info[CD_COUNT][CD_CONTENT].c_str()
+ );
}
}
}
@@ -43,9 +51,9 @@ static void print_crash_report(const map_crash_report_t& pCrashReport)
{
if (it->second[CD_TYPE] != CD_SYS)
{
- std::cout << std::endl << it->first << std::endl;
- std::cout << "-----" << std::endl;
- std::cout << it->second[CD_CONTENT] << std::endl;
+ printf("\n%s\n"
+ "-----\n"
+ "%s\n", it->first.c_str(), it->second[CD_CONTENT].c_str());
}
}
}
@@ -205,12 +213,13 @@ int main(int argc, char** argv)
else
progname = argv[0];
/* note: message has embedded tabs */
- std::cout << "Usage: " << progname << " [OPTION]\n\n"
+ printf("Usage: %s [OPTION]\n\n"
" --get-list print list of crashes which are not reported\n"
" --get-list-full print list of all crashes\n"
" --report UUID create and send a report\n"
" --report-always UUID create and send a report without asking\n"
- " --delete UUID delete crash\n";
+ " --delete UUID delete crash\n",
+ progname);
return 1;
}
if (c == -1)
@@ -240,11 +249,11 @@ int main(int argc, char** argv)
{
map_crash_report_t cr = call_CreateReport(uuid);
print_crash_report(cr);
- std::cout << "\nDo you want to send the report? [y/n]: ";
- std::flush(std::cout);
- std::string answer = "n";
- std::cin >> answer;
- if (answer == "Y" || answer == "y")
+ printf("\nDo you want to send the report? [y/n]: ");
+ fflush(NULL);
+ char answer[16] = "n";
+ fgets(answer, sizeof(answer), stdin);
+ if (answer[0] == 'Y' || answer[0] == 'y')
{
call_Report(cr);
}