aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_util.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-18 14:42:38 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-20 21:32:03 -0700
commit4deb46290da1f89422cf1f269b516317d98822a6 (patch)
tree39ab5aed46c7bac35bb1f5be556cddcb072a95f3 /parse_util.cpp
parente5ef45e4c04b6126ea74c4010b2d8fe1c0b06cca (diff)
Remove additional dead code from old parser
Diffstat (limited to 'parse_util.cpp')
-rw-r--r--parse_util.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/parse_util.cpp b/parse_util.cpp
index dda4f6a7..f1182ac2 100644
--- a/parse_util.cpp
+++ b/parse_util.cpp
@@ -986,6 +986,18 @@ static int parser_is_pipe_forbidden(const wcstring &word)
L"continue");
}
+bool parse_util_argument_is_help(const wchar_t *s, int min_match)
+{
+ CHECK(s, 0);
+
+ size_t len = wcslen(s);
+
+ min_match = maxi(min_match, 3);
+
+ return (wcscmp(L"-h", s) == 0) ||
+ (len >= (size_t)min_match && (wcsncmp(L"--help", s, len) == 0));
+}
+
// Check if the first argument under the given node is --help
static bool first_argument_is_help(const parse_node_tree_t &node_tree, const parse_node_t &node, const wcstring &src)
{
@@ -996,7 +1008,7 @@ static bool first_argument_is_help(const parse_node_tree_t &node_tree, const par
// Check the first argument only
const parse_node_t &arg = *arg_nodes.at(0);
const wcstring first_arg_src = arg.get_source(src);
- is_help = parser_t::is_help(first_arg_src.c_str(), 3);
+ is_help = parse_util_argument_is_help(first_arg_src.c_str(), 3);
}
return is_help;
}