diff options
author | Petteri Räty <petsku@petteriraty.eu> | 2010-08-24 20:19:01 +0300 |
---|---|---|
committer | Petteri Räty <petsku@petteriraty.eu> | 2010-08-29 11:56:25 +0300 |
commit | ce1258fafa4ccf48ce58edfd2661dc094ecfedf4 (patch) | |
tree | 9c7d88b5224f314e6ad9ba40f4851830e1b0dc29 /src | |
parent | Handle autoreconf warnings (diff) | |
download | libbash-ce1258fafa4ccf48ce58edfd2661dc094ecfedf4.tar.gz libbash-ce1258fafa4ccf48ce58edfd2661dc094ecfedf4.tar.bz2 libbash-ce1258fafa4ccf48ce58edfd2661dc094ecfedf4.zip |
Fix indentation
Some files had tabs although our style guide tells to use spaces. Used
vim to reindent those files.
Diffstat (limited to 'src')
-rw-r--r-- | src/builtins/builtins.h | 24 | ||||
-rw-r--r-- | src/builtins/echo_builtin.cpp | 136 | ||||
-rw-r--r-- | src/builtins/echo_builtin.h | 44 | ||||
-rw-r--r-- | src/builtins/tests/run_tests.cpp | 28 | ||||
-rw-r--r-- | src/cppbash_builtin.cpp | 24 | ||||
-rw-r--r-- | src/cppbash_builtin.h | 102 |
6 files changed, 179 insertions, 179 deletions
diff --git a/src/builtins/builtins.h b/src/builtins/builtins.h index b954b8d..42415e1 100644 --- a/src/builtins/builtins.h +++ b/src/builtins/builtins.h @@ -1,20 +1,20 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. + */ /// /// \file builtins.h /// \author Nathan Eloe diff --git a/src/builtins/echo_builtin.cpp b/src/builtins/echo_builtin.cpp index 909458b..3fcc3de 100644 --- a/src/builtins/echo_builtin.cpp +++ b/src/builtins/echo_builtin.cpp @@ -1,19 +1,19 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. */ /// /// \file echo_builtin.cpp @@ -30,17 +30,17 @@ echo_builtin::echo_builtin(std::ostream &outstream, std::ostream &errstream, std int echo_builtin::exec(std::vector<std::string> bash_args) { //figure out just what the options are - bool suppress_nl; - bool escapes_enabled; - determine_options(bash_args, suppress_nl, escapes_enabled); + bool suppress_nl; + bool escapes_enabled; + determine_options(bash_args, suppress_nl, escapes_enabled); if (escapes_enabled) { - suppress_nl = (suppress_nl || newline_suppressed(bash_args)); + suppress_nl = (suppress_nl || newline_suppressed(bash_args)); replace_escapes(bash_args); } - std::copy(bash_args.begin(), bash_args.end()-1, std::ostream_iterator<std::string>(this->out_buffer()," ")); - this->out_buffer() << *(bash_args.end()-1); - if (!suppress_nl) + std::copy(bash_args.begin(), bash_args.end()-1, std::ostream_iterator<std::string>(this->out_buffer()," ")); + this->out_buffer() << *(bash_args.end()-1); + if (!suppress_nl) { this->out_buffer() << std::endl; } @@ -49,61 +49,61 @@ int echo_builtin::exec(std::vector<std::string> bash_args) void echo_builtin::determine_options(std::vector<std::string> &args, bool &suppress_nl, bool &enable_escapes) { - enable_escapes=false; - suppress_nl=false; - bool sup_nl=false; - bool en_esc=false; - bool real_opts; - for (int i=0; i<args.size(); i++) - { - if (*(args[i].begin()) == '-') - { - real_opts=true; - for (std::string::iterator j = args[i].begin()+1; j != args[i].end(); j++) - { - if (*j=='n') - { - sup_nl=true; - } - else if (*j=='e') - { - en_esc=true; - } - else if (*j=='E') - { - en_esc=false; - } - else - { - real_opts=false; - } - } - if (real_opts) - { - args.erase(args.begin()+i); - i--; - suppress_nl=sup_nl; - enable_escapes=en_esc; - } - } - else - { - i=args.size(); - } - } + enable_escapes=false; + suppress_nl=false; + bool sup_nl=false; + bool en_esc=false; + bool real_opts; + for (int i=0; i<args.size(); i++) + { + if (*(args[i].begin()) == '-') + { + real_opts=true; + for (std::string::iterator j = args[i].begin()+1; j != args[i].end(); j++) + { + if (*j=='n') + { + sup_nl=true; + } + else if (*j=='e') + { + en_esc=true; + } + else if (*j=='E') + { + en_esc=false; + } + else + { + real_opts=false; + } + } + if (real_opts) + { + args.erase(args.begin()+i); + i--; + suppress_nl=sup_nl; + enable_escapes=en_esc; + } + } + else + { + i=args.size(); + } + } } bool echo_builtin::newline_suppressed(std::vector<std::string> &args) { bool suppressed = false; - for (int i = 0; i < args.size(); i++) - { - while (args[i].find("\\c")!=std::string::npos) - { - suppressed = true; - replace_all(args[i], "\\c", ""); - } - } + for (int i = 0; i < args.size(); i++) + { + while (args[i].find("\\c")!=std::string::npos) + { + suppressed = true; + replace_all(args[i], "\\c", ""); + } + } return suppressed; } diff --git a/src/builtins/echo_builtin.h b/src/builtins/echo_builtin.h index 2de7230..3e5dee2 100644 --- a/src/builtins/echo_builtin.h +++ b/src/builtins/echo_builtin.h @@ -1,20 +1,20 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. + */ /// /// \file echo_builtin.h /// \author Nathan Eloe @@ -37,9 +37,9 @@ class echo_builtin: public virtual cppbash_builtin public: /// /// \brief default constructor, sets default streams - /// \param outstream where to send standard output. Default: cout - /// \param errstream where to send standard error. Default: cerr - /// \param instream where to get standard input from. Default cin + /// \param outstream where to send standard output. Default: cout + /// \param errstream where to send standard error. Default: cerr + /// \param instream where to get standard input from. Default cin /// echo_builtin(std::ostream &outstream=std::cout, std::ostream &errstream=std::cerr, std::istream &instream=std::cin); /// @@ -49,19 +49,19 @@ class echo_builtin: public virtual cppbash_builtin /// virtual int exec(std::vector<std::string> bash_args); private: - /// - /// \brief determines the options passed as arguments - /// \param args list of arguments passed to echo - /// \param suppress_nl returns back whether to suppress newlines - /// \param enable_escapes returns back whether to enable escapes - void determine_options(std::vector<std::string> &args, bool &suppress_nl, bool &enable_escapes); + /// + /// \brief determines the options passed as arguments + /// \param args list of arguments passed to echo + /// \param suppress_nl returns back whether to suppress newlines + /// \param enable_escapes returns back whether to enable escapes + void determine_options(std::vector<std::string> &args, bool &suppress_nl, bool &enable_escapes); /// /// \brief checks to see if the trailing newline is suppressed /// \param args arguments to check, removes suppressing escape sequences /// \return true if newlines are suppressed, false otherwise /// bool newline_suppressed(std::vector<std::string> &args); - /// + /// /// \brief replaces all escape seqs in std::string with actual escape seq. /// \param args list of arguments to replace escape sequences in /// diff --git a/src/builtins/tests/run_tests.cpp b/src/builtins/tests/run_tests.cpp index 0f1fea3..fc16a5f 100644 --- a/src/builtins/tests/run_tests.cpp +++ b/src/builtins/tests/run_tests.cpp @@ -1,20 +1,20 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. + */ /// /// \file run_tests.cpp /// \brief runs unit tests for builtin bash functionality @@ -27,6 +27,6 @@ along with libbash. If not, see <http://www.gnu.org/licenses/>. /// int main(int argc, char* argv[]) { - ::testing::InitGoogleTest (&argc, argv); - return RUN_ALL_TESTS(); + ::testing::InitGoogleTest (&argc, argv); + return RUN_ALL_TESTS(); } diff --git a/src/cppbash_builtin.cpp b/src/cppbash_builtin.cpp index 82cfe56..ddb4310 100644 --- a/src/cppbash_builtin.cpp +++ b/src/cppbash_builtin.cpp @@ -1,20 +1,20 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. + */ /// /// \file cppbash_builtin.cpp /// \author Nathan Eloe diff --git a/src/cppbash_builtin.h b/src/cppbash_builtin.h index 3d918b1..efb5e2b 100644 --- a/src/cppbash_builtin.h +++ b/src/cppbash_builtin.h @@ -1,20 +1,20 @@ /* -Copyright 2010 Nathan Eloe + Copyright 2010 Nathan Eloe -This file is part of libbash. + 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 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. + 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 <http://www.gnu.org/licenses/>. -*/ + You should have received a copy of the GNU General Public License + along with libbash. If not, see <http://www.gnu.org/licenses/>. + */ /// /// \file cppbash_builtin.h /// \author Nathan Eloe @@ -35,49 +35,49 @@ along with libbash. If not, see <http://www.gnu.org/licenses/>. class cppbash_builtin { public: - /// - /// \brief Default constructor, sets default streams - /// \param outstream where to send standard output. Default: cout - /// \param errstream where to send standard error. Default: cerr - /// \param instream where to get standard input from. Default: stdin - /// + /// + /// \brief Default constructor, sets default streams + /// \param outstream where to send standard output. Default: cout + /// \param errstream where to send standard error. Default: cerr + /// \param instream where to get standard input from. Default: stdin + /// cppbash_builtin(std::ostream &outstream, std::ostream &errstream, std::istream &instream); - /// - /// \brief executes the code associated with the builtin - /// \param bash_args arguments passed to the builtin - /// \return return status of the command - /// + /// + /// \brief executes the code associated with the builtin + /// \param bash_args arguments passed to the builtin + /// \return return status of the command + /// virtual int exec(std::vector<std::string> bash_args)=0; - /// - /// \brief accessor to the std output stream - /// \return output buffer for the builtin - /// - std::ostream& out_buffer() {return *_out_stream;} - /// - /// \brief accessor to the std error stream - /// \return error buffer for the builtin - /// - std::ostream& err_buffer() {return *_err_stream;} - /// - /// \brief accessor to the std input stream - /// \return input buffer for the builtin - /// - std::istream& input_buffer() {return *_inp_stream;} - protected: - /// - /// \var *_out_stream - /// \brief current standard output stream - /// + /// + /// \brief accessor to the std output stream + /// \return output buffer for the builtin + /// + std::ostream& out_buffer() {return *_out_stream;} + /// + /// \brief accessor to the std error stream + /// \return error buffer for the builtin + /// + std::ostream& err_buffer() {return *_err_stream;} + /// + /// \brief accessor to the std input stream + /// \return input buffer for the builtin + /// + std::istream& input_buffer() {return *_inp_stream;} + protected: + /// + /// \var *_out_stream + /// \brief current standard output stream + /// std::ostream *_out_stream; - /// - /// \var *_err_stream - /// \brief current standard error stream - /// + /// + /// \var *_err_stream + /// \brief current standard error stream + /// std::ostream *_err_stream; - /// - /// \var *_inp_stream - /// \brief current standard input stream - /// + /// + /// \var *_inp_stream + /// \brief current standard input stream + /// std::istream *_inp_stream; }; |