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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
--- a/libs/process/src/shell.cpp
+++ b/libs/process/src/shell.cpp
@@ -19,8 +19,6 @@
#if defined(BOOST_PROCESS_V2_WINDOWS)
#include <windows.h>
#include <shellapi.h>
-#elif !defined(__OpenBSD__)
-#include <wordexp.h>
#endif
BOOST_PROCESS_V2_BEGIN_NAMESPACE
@@ -30,42 +28,6 @@
{
return system_category();
}
-#elif !defined(__OpenBSD__)
-
-struct shell_category_t final : public error_category
-{
- shell_category_t() : error_category(0xDAF1u) {}
-
- const char* name() const noexcept
- {
- return "process.v2.shell";
- }
- std::string message(int value) const
- {
- switch (value)
- {
- case WRDE_BADCHAR:
- return "Illegal occurrence of newline or one of |, &, ;, <, >, (, ), {, }.";
- case WRDE_BADVAL:
- return "An undefined shell variable was referenced, and the WRDE_UNDEF flag told us to consider this an error.";
- case WRDE_CMDSUB:
- return "Command substitution occurred, and the WRDE_NOCMD flag told us to consider this an error.";
- case WRDE_NOSPACE:
- return "Out of memory.";
- case WRDE_SYNTAX:
- return "Shell syntax error, such as unbalanced parentheses or unmatched quotes.";
- default:
- return "process.v2.wordexp error";
- }
- }
-};
-
-BOOST_PROCESS_V2_DECL const error_category& get_shell_category()
-{
- static shell_category_t instance;
- return instance;
-}
-
#else
const error_category& get_shell_category()
@@ -99,49 +61,6 @@
return input_.c_str();
}
-#elif !defined(__OpenBSD__)
-
-void shell::parse_()
-{
- wordexp_t we{};
- auto cd = wordexp(input_.c_str(), &we, WRDE_NOCMD);
-
- if (cd != 0)
- detail::throw_error(error_code(cd, get_shell_category()), "shell::parse");
- else
- {
- argc_ = static_cast<int>(we.we_wordc);
- argv_ = we.we_wordv;
- }
-
- free_argv_ = +[](int argc, char ** argv)
- {
- wordexp_t we{
- .we_wordc = static_cast<std::size_t>(argc),
- .we_wordv = argv,
- .we_offs = 0
- };
- wordfree(&we);
- };
-}
-
-shell::~shell()
-{
- if (argv_ != nullptr && free_argv_ != nullptr)
- free_argv_(argc_, argv_);
-}
-
-auto shell::args() const -> args_type
-{
- if (argc() == 0)
- {
- static const char * helper = nullptr;
- return &helper;
- }
- else
- return const_cast<const char**>(argv());
-}
-
#else
void shell::parse_()
|