diff options
author | Michael Vogt <mvo@debian.org> | 2014-02-27 22:52:34 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-02-27 22:52:34 +0100 |
commit | fce69e7a0f38299c57ef96ae1c1dd9a5379bfd5a (patch) | |
tree | be7d18baa836e9df166ec63f6c9fe6f94bb84b40 /apt-private/private-utils.cc | |
parent | a5e790985752c6820e08e7a7e650e1607fa826e4 (diff) | |
parent | fc104da6a583736223b2f941e43a05ea26b63a7d (diff) |
Merge branch 'debian/sid' into debian/experimental
Conflicts:
apt-private/private-list.cc
configure.ac
debian/apt.install.in
debian/changelog
Diffstat (limited to 'apt-private/private-utils.cc')
-rw-r--r-- | apt-private/private-utils.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/apt-private/private-utils.cc b/apt-private/private-utils.cc new file mode 100644 index 000000000..813f19329 --- /dev/null +++ b/apt-private/private-utils.cc @@ -0,0 +1,50 @@ +#include <cstdlib> + +#include <apt-pkg/configuration.h> +#include <apt-pkg/fileutl.h> +#include "private-utils.h" + + +// DisplayFileInPager - Display File with pager /*{{{*/ +void DisplayFileInPager(std::string filename) +{ + std::string pager = _config->Find("Dir::Bin::Pager", + "/usr/bin/sensible-pager"); + + pid_t Process = ExecFork(); + if (Process == 0) + { + const char *Args[3]; + Args[0] = pager.c_str(); + Args[1] = filename.c_str(); + Args[2] = 0; + execvp(Args[0],(char **)Args); + exit(100); + } + + // Wait for the subprocess + ExecWait(Process, "sensible-pager", false); +} + /*}}}*/ + +// EditFileInSensibleEditor - Edit File with editor /*{{{*/ +void EditFileInSensibleEditor(std::string filename) +{ + std::string editor = _config->Find("Dir::Bin::Editor", + "/usr/bin/sensible-editor"); + + pid_t Process = ExecFork(); + if (Process == 0) + { + const char *Args[3]; + Args[0] = editor.c_str(); + Args[1] = filename.c_str(); + Args[2] = 0; + execvp(Args[0],(char **)Args); + exit(100); + } + + // Wait for the subprocess + ExecWait(Process, "sensible-editor", false); +} + /*}}}*/ |