diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-04-19 19:49:15 -0700 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-04-26 21:58:59 -0700 |
commit | df10b53c0caecd43a02b7f24515a9ff9edea7056 (patch) | |
tree | c4330d36de296ee75a608a6665091134be780167 /src/builtin.cpp | |
parent | c2f9d60eb1f04a3aa0b01d785c1e133cac8ecf1d (diff) |
restyle builtin modules to match project style
Now that the IWYU cleanup has been merged compile all, not just a couple, of
the builtin modules independent of builtin.cpp. That is, no longer `#include
builtin_NAME.cpp` in builtin.cpp. This is more consistent, more in line with
what developers expect, and is likely to reduce mistakes.
Reduces lint errors from 384 to 336 (-13%). Line count from 6307 to 4988 (-21%).
Another step in resolving issue #2902.
Diffstat (limited to 'src/builtin.cpp')
-rw-r--r-- | src/builtin.cpp | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/builtin.cpp b/src/builtin.cpp index b7a84c69..b0356543 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -1,3 +1,4 @@ +// // Functions for executing builtin functions. // // How to add a new builtin function: @@ -19,6 +20,8 @@ #include <assert.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -29,24 +32,33 @@ #include <wctype.h> #include <algorithm> #include <map> +#include <memory> // IWYU pragma: keep #include <string> #include <utility> -#include <limits.h> -#include <memory> // IWYU pragma: keep -#include <stdbool.h> -#include "fallback.h" // IWYU pragma: keep #include "builtin.h" +#include "builtin_commandline.h" +#include "builtin_complete.h" +#include "builtin_jobs.h" +#include "builtin_printf.h" +#include "builtin_set.h" +#include "builtin_set_color.h" +#include "builtin_string.h" +#include "builtin_test.h" +#include "builtin_ulimit.h" +#include "common.h" #include "complete.h" #include "env.h" #include "event.h" #include "exec.h" #include "expand.h" +#include "fallback.h" // IWYU pragma: keep #include "function.h" #include "highlight.h" #include "history.h" #include "input.h" #include "intern.h" +#include "io.h" #include "parse_constants.h" #include "parse_util.h" #include "parser.h" @@ -58,9 +70,7 @@ #include "tokenizer.h" #include "wcstringutil.h" #include "wgetopt.h" -#include "wutil.h" -#include "common.h" -#include "io.h" +#include "wutil.h" // IWYU pragma: keep // The default prompt for the read command. #define DEFAULT_READ_PROMPT L"set_color green; echo -n read; set_color normal; echo -n \"> \"" @@ -241,7 +251,7 @@ void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wch builtin_print_help(parser, streams, cmd, streams.err); } -// Here follows the definition of all builtin commands. The function names are all on the form +// Here follows the definition of all builtin commands. The function names are all of the form // builtin_NAME where NAME is the name of the builtin. so the function name for the builtin 'fg' is // 'builtin_fg'. // @@ -253,21 +263,7 @@ void builtin_missing_argument(parser_t &parser, io_streams_t &streams, const wch // implementation, namely 'builtin_break_continue. // // Several other builtins, including jobs, ulimit and set are so big that they have been given their -// own file. These files are all named 'builtin_NAME.c', where NAME is the name of the builtin. -// These files are included directly below. -#include "builtin_commandline.cpp" -#include "builtin_complete.cpp" -#include "builtin_jobs.cpp" -#include "builtin_printf.cpp" -#include "builtin_set.cpp" -#include "builtin_set_color.cpp" -#include "builtin_ulimit.cpp" - -// builtin_test lives in builtin_test.cpp -int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv); - -// builtin_string lives in builtin_string.cpp -int builtin_string(parser_t &parser, io_streams_t &streams, wchar_t **argv); +// own module. These files are all named 'builtin_NAME.cpp', where NAME is the name of the builtin. /// List a single key binding. /// Returns false if no binding with that sequence and mode exists. |