]> git.saurik.com Git - apt.git/blame - apt-private/private-utils.cc
doc/po/pt.po: updated, thanks to Américo Monteir
[apt.git] / apt-private / private-utils.cc
CommitLineData
453b82a3 1#include <config.h>
cfacba52
MV
2
3#include <apt-pkg/configuration.h>
4#include <apt-pkg/fileutl.h>
cfacba52 5
453b82a3
DK
6#include <apt-private/private-utils.h>
7
8#include <cstdlib>
9#include <unistd.h>
cfacba52
MV
10
11// DisplayFileInPager - Display File with pager /*{{{*/
12void DisplayFileInPager(std::string filename)
13{
14 std::string pager = _config->Find("Dir::Bin::Pager",
15 "/usr/bin/sensible-pager");
16
17 pid_t Process = ExecFork();
18 if (Process == 0)
19 {
20 const char *Args[3];
21 Args[0] = pager.c_str();
22 Args[1] = filename.c_str();
23 Args[2] = 0;
24 execvp(Args[0],(char **)Args);
25 exit(100);
26 }
27
28 // Wait for the subprocess
29 ExecWait(Process, "sensible-pager", false);
30}
31 /*}}}*/
cfacba52
MV
32// EditFileInSensibleEditor - Edit File with editor /*{{{*/
33void EditFileInSensibleEditor(std::string filename)
34{
35 std::string editor = _config->Find("Dir::Bin::Editor",
36 "/usr/bin/sensible-editor");
37
38 pid_t Process = ExecFork();
39 if (Process == 0)
40 {
41 const char *Args[3];
42 Args[0] = editor.c_str();
43 Args[1] = filename.c_str();
44 Args[2] = 0;
45 execvp(Args[0],(char **)Args);
46 exit(100);
47 }
48
49 // Wait for the subprocess
50 ExecWait(Process, "sensible-editor", false);
51}
52 /*}}}*/