]>
Commit | Line | Data |
---|---|---|
1 | #include <config.h> | |
2 | ||
3 | #include <apt-pkg/configuration.h> | |
4 | #include <apt-pkg/fileutl.h> | |
5 | ||
6 | #include <apt-private/private-utils.h> | |
7 | ||
8 | #include <cstdlib> | |
9 | #include <unistd.h> | |
10 | ||
11 | // DisplayFileInPager - Display File with pager /*{{{*/ | |
12 | void 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 | /*}}}*/ | |
32 | // EditFileInSensibleEditor - Edit File with editor /*{{{*/ | |
33 | void 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 | /*}}}*/ |