diff options
author | 2013-12-27 03:58:42 -0800 | |
---|---|---|
committer | 2013-12-27 03:58:42 -0800 | |
commit | 715823a6665a63df5a7ae6e5a9adcbe287626c1c (patch) | |
tree | ee5c765433fb3ce668ce5bf34925f92da13c5d13 /builtin.cpp | |
parent | 6ce4b344e45baaa06bf593a5c0983da7a22eb64e (diff) |
Bringup of function definitions, switch statements with new parser
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin.cpp b/builtin.cpp index 11036e37..215edc59 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1753,10 +1753,15 @@ static int builtin_pwd(parser_t &parser, wchar_t **argv) } /* This is nearly identical to builtin_function, and is intended to be the successor (with no block manipulation, no function/end split) */ -int define_function(parser_t &parser, const wcstring_list_t &args, const wcstring &contents, wcstring *out_err) +int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstring &contents, wcstring *out_err) { assert(out_err != NULL); + /* wgetopt expects 'function' as the first argument. Make a new wcstring_list with that property. */ + wcstring_list_t args; + args.push_back(L"function"); + args.insert(args.end(), c_args.begin(), c_args.end()); + /* Hackish const_cast matches the one in builtin_run */ const null_terminated_array_t<wchar_t> argv_array(args); wchar_t **argv = const_cast<wchar_t **>(argv_array.get()); |