#include <string>
#include <utility>
#include <vector>
+#include <sstream>
#include <apti18n.h>
/*}}}*/
using namespace std;
+APT_PURE static string
+AptHistoryUser()
+{
+ stringstream out;
+ const char* env[]{"SUDO_USER", "PKEXEC_UID", nullptr};
+ for (int i=0; env[i] != nullptr; i++)
+ {
+ if (getenv(env[i]) != nullptr)
+ {
+ out << env[i] << "=" << getenv(env[i]) << " ";
+ }
+ }
+ return out.str();
+}
+
APT_PURE static unsigned int
EnvironmentSize()
{
}
if (_config->Exists("Commandline::AsString") == true)
WriteHistoryTag("Commandline", _config->Find("Commandline::AsString"));
+ if (AptHistoryUser() != "")
+ WriteHistoryTag("Requested-By", AptHistoryUser());
WriteHistoryTag("Install", install);
WriteHistoryTag("Reinstall", reinstall);
WriteHistoryTag("Upgrade", upgrade);
std::vector<const char *> Args(sArgs.size(), NULL);
std::transform(sArgs.begin(), sArgs.end(), Args.begin(),
[](std::string const &s) { return s.c_str(); });
- unsigned long long const StartSize = std::accumulate(sArgs.begin(), sArgs.end(), 0,
+ unsigned long long const StartSize = std::accumulate(sArgs.begin(), sArgs.end(), 0llu,
[](unsigned long long const i, std::string const &s) { return i + s.length(); });
size_t const BaseArgs = Args.size();