diff options
author | Michael Vogt <mvo@debian.org> | 2013-11-29 14:39:27 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-11-29 14:39:27 +0100 |
commit | e2264d3f957694e229a9f6976fc136b8f82ad770 (patch) | |
tree | c1f0b9c64d1d60defe5ce1a89c6bc136d758a772 /apt-private/private-utils.cc | |
parent | fd4e73c33c20873af670ee40b549c46ee0d50801 (diff) | |
parent | c9a5f74bd57fa4fcf4e30cade8e48c5635448689 (diff) |
Merge branch 'debian/sid' into ubuntu/master
Conflicts:
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); +} + /*}}}*/ |