blob: 813f193294d051e7c9f2e5fce079707943baa9d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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);
}
/*}}}*/
|