diff -rc2P libbash-original//Makefile.am libbash-modified//Makefile.am
*** libbash-original//Makefile.am Thu Apr 12 15:48:50 2012
--- libbash-modified//Makefile.am Thu Apr 12 17:48:17 2012
***************
*** 237,240 ****
--- 237,242 ----
src/builtins/unset_builtin.h \
src/builtins/unset_builtin.cpp \
+ src/builtins/set_builtin.h \
+ src/builtins/set_builtin.cpp \
src/builtins/builtin_exceptions.h \
$(GENERATED_PARSER_C) \
diff -rc2P libbash-original//src/builtins/set_builtin.cpp libbash-modified//src/builtins/set_builtin.cpp
*** libbash-original//src/builtins/set_builtin.cpp Thu Jan 1 03:00:00 1970
--- libbash-modified//src/builtins/set_builtin.cpp Thu Apr 12 19:18:20 2012
***************
*** 0 ****
--- 1,40 ----
+ /*
+ Please use git log for copyright holder and year information
+
+ This file is part of libbash.
+
+ libbash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ libbash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libbash. If not, see .
+ */
+ ///
+ /// \file set_builtin.cpp
+ /// \brief implementation for the set builtin
+ ///
+ #include "builtins/set_builtin.h"
+ #include "core/interpreter.h"
+
+ #include
+
+ int set_builtin::exec(const std::vector& bash_args)
+ {
+ if(bash_args.empty())
+ return 0;
+
+ if(bash_args[0] == "--") {
+ int i = 1;
+ for (auto iter = bash_args.begin() + 1; iter != bash_args.end(); ++iter, ++i)
+ _walker.define(boost::lexical_cast(i), *iter);
+ }
+
+ return 0;
+ }
diff -rc2P libbash-original//src/builtins/set_builtin.h libbash-modified//src/builtins/set_builtin.h
*** libbash-original//src/builtins/set_builtin.h Thu Jan 1 03:00:00 1970
--- libbash-modified//src/builtins/set_builtin.h Thu Apr 12 17:48:17 2012
***************
*** 0 ****
--- 1,39 ----
+ /*
+ Please use git log for copyright holder and year information
+
+ This file is part of libbash.
+
+ libbash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ libbash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libbash. If not, see .
+ */
+ ///
+ /// \file unset_builtin.h
+ /// \brief implementation for the unset builtin
+ ///
+ #ifndef LIBBASH_BUILTINS_UNSET_BUILTIN_H_
+ #define LIBBASH_BUILTINS_UNSET_BUILTIN_H_
+
+ #include "cppbash_builtin.h"
+
+ ///
+ /// \class unset_builtin
+ /// \brief the unset builtin for bash
+ ///
+ class unset_builtin : public virtual cppbash_builtin
+ {
+ public:
+ BUILTIN_CONSTRUCTOR(set)
+ virtual int exec(const std::vector& bash_args);
+ };
+
+ #endif
diff -rc2P libbash-original//src/cppbash_builtin.cpp libbash-modified//src/cppbash_builtin.cpp
*** libbash-original//src/cppbash_builtin.cpp Thu Apr 12 15:48:50 2012
--- libbash-modified//src/cppbash_builtin.cpp Thu Apr 12 17:48:17 2012
***************
*** 45,48 ****
--- 45,49 ----
#include "builtins/source_builtin.h"
#include "builtins/unset_builtin.h"
+ #include "builtins/set_builtin.h"
namespace qi = boost::spirit::qi;
***************
*** 74,77 ****
--- 75,79 ----
{"let", boost::factory()},
{"unset", boost::factory()},
+ {"set", boost::factory()},
});
return *p;