mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 00:47:30 +00:00
Remove now unused in C++ hacks
This commit is contained in:
parent
eacbd6156d
commit
ea704179c1
2 changed files with 0 additions and 51 deletions
|
@ -1282,51 +1282,3 @@ expand_result_t expand_to_command_and_args(const wcstring &instr, const operatio
|
|||
}
|
||||
return expand_err;
|
||||
}
|
||||
|
||||
// https://github.com/fish-shell/fish-shell/issues/367
|
||||
//
|
||||
// With them the Seed of Wisdom did I sow,
|
||||
// And with my own hand labour'd it to grow:
|
||||
// And this was all the Harvest that I reap'd---
|
||||
// "I came like Water, and like Wind I go."
|
||||
|
||||
static std::string escape_single_quoted_hack_hack_hack_hack(const char *str) {
|
||||
std::string result;
|
||||
size_t len = std::strlen(str);
|
||||
result.reserve(len + 2);
|
||||
result.push_back('\'');
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
char c = str[i];
|
||||
// Escape backslashes and single quotes only.
|
||||
if (c == '\\' || c == '\'') result.push_back('\\');
|
||||
result.push_back(c);
|
||||
}
|
||||
result.push_back('\'');
|
||||
return result;
|
||||
}
|
||||
|
||||
bool fish_xdm_login_hack_hack_hack_hack(std::vector<std::string> *cmds, int argc,
|
||||
const char *const *argv) {
|
||||
if (!cmds || cmds->size() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
const std::string &cmd = cmds->at(0);
|
||||
if (cmd == "exec \"${@}\"" || cmd == "exec \"$@\"") {
|
||||
// We're going to construct a new command that starts with exec, and then has the
|
||||
// remaining arguments escaped.
|
||||
std::string new_cmd = "exec";
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
if (arg) {
|
||||
new_cmd.push_back(' ');
|
||||
new_cmd.append(escape_single_quoted_hack_hack_hack_hack(arg));
|
||||
}
|
||||
}
|
||||
|
||||
cmds->at(0) = new_cmd;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -207,7 +207,4 @@ void expand_tilde(wcstring &input, const environment_t &vars);
|
|||
/// Perform the opposite of tilde expansion on the string, which is modified in place.
|
||||
wcstring replace_home_directory_with_tilde(const wcstring &str, const environment_t &vars);
|
||||
|
||||
// Terrible hacks
|
||||
bool fish_xdm_login_hack_hack_hack_hack(std::vector<std::string> *cmds, int argc,
|
||||
const char *const *argv);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue