From ca7512a5872c85630137bedbad0bc321124f55a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vin=C3=ADcius=20R=2E=20Miguel?= Date: Wed, 3 Jun 2020 20:23:52 -0300 Subject: [PATCH] Less idiotic includes --- Headers/input.h | 22 ++-------------------- Headers/opsys.h | 2 ++ Sources/input.cpp | 16 +++++++++++++++- Sources/main.cpp | 3 +++ Sources/opsys.cpp | 9 +++++++++ 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Headers/input.h b/Headers/input.h index 1cace86..2f7c5e8 100644 --- a/Headers/input.h +++ b/Headers/input.h @@ -1,29 +1,11 @@ #ifndef INPUT_H #define INPUT_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // strings +#include // vectors -using std::cout; -using std::cin; -using std::cerr; using std::string; using std::vector; -using std::istringstream; -using std::copy; -using std::istream_iterator; -using std::ostream_iterator; #define RED_ANSI "\x1b[31m" // ANSI escape code for red #define BLUE_ANSI "\x1b[34m" // ANSI escape code for blue diff --git a/Headers/opsys.h b/Headers/opsys.h index 157743e..24ecfd8 100644 --- a/Headers/opsys.h +++ b/Headers/opsys.h @@ -2,6 +2,8 @@ #define OPSYS_H #include "input.h" +#include // struct sigaction, sigaction, SIGINT, SIGHUP +#include // std::cin, std::cout, printf, fprintf extern bool exit_program; /*! diff --git a/Sources/input.cpp b/Sources/input.cpp index 8e01fd4..1a0c6b7 100644 --- a/Sources/input.cpp +++ b/Sources/input.cpp @@ -1,8 +1,22 @@ #include "Headers/opsys.h" +#include // std::regex and std::regex_replace bool is_verbose = false; bool cwd_changed = false; +#include // fork, execvp +#include // struct password, getpwuid_r +#include // isstreams, osstreams +#include // copy +#include // istream_iterator, iterator, back_inserter + +using std::istringstream; +using std::copy; +using std::istream_iterator; +using std::ostream_iterator; +using std::cin; +using std::cout; + CLIInputs::CLIInputs(int argc, char **argv) { if(argc > 1) @@ -19,7 +33,7 @@ CLIInputs::CLIInputs(int argc, char **argv) if (!s_argv.compare("-v") || !s_argv.compare("--verbose")) { printf("Executing in verbose mode.\n"); - is_verbose = false; + is_verbose = true; } } } diff --git a/Sources/main.cpp b/Sources/main.cpp index 3424c3a..a11c06d 100644 --- a/Sources/main.cpp +++ b/Sources/main.cpp @@ -1,5 +1,8 @@ #include "Headers/opsys.h" +using std::cin; +using std::cout; + int main(int argc, char ** argv) { cout << "miniSHELL 2 -- github.com/vrmiguel/minishell2\n"; diff --git a/Sources/opsys.cpp b/Sources/opsys.cpp index 8c80c7d..ddbe198 100644 --- a/Sources/opsys.cpp +++ b/Sources/opsys.cpp @@ -1,5 +1,14 @@ #include "Headers/opsys.h" +#include // MAXPATHLEN +#include // waitpid +#include // getcwd, fork, chdir, geuid, gethostname, execvp +#include // struct passwd, getpwuid_r + +using std::cin; +using std::cout; +using std::cerr; + OpSys OS; // Global OpSys variable. Should be accessible to all modules. bool exit_program = false; -- 2.11.4.GIT