diff --git a/src/Makefile.am b/src/Makefile.am index 0a3764a718f0f1a102ec249a0fa9700ba2f9ed41..bf6a74614af001dd3dcecac2a516344e019de257 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,4 +2,4 @@ bin_PROGRAMS = ncdu ncdu_SOURCES = browser.c calc.c delete.c exclude.c help.c main.c path.c util.c -noinst_HEADERS = browser.h calc.h delete.h exclude.h help.h ncdu.h path.h util.h +noinst_HEADERS = browser.h calc.h delete.h exclude.h global.h help.h path.h util.h diff --git a/src/browser.c b/src/browser.c index abe84f83a6edf40cfce8cdc171951d17f66c3106..3961cfa685e869f5bfe3aab01e58bb1e9361407a 100644 --- a/src/browser.c +++ b/src/browser.c @@ -23,12 +23,7 @@ */ -#include "ncdu.h" -#include "browser.h" -#include "util.h" -#include "calc.h" -#include "delete.h" -#include "help.h" +#include "global.h" #include <string.h> #include <stdlib.h> @@ -418,14 +413,12 @@ int browse_key(int ch) { nonfo++; break; - /* refresh */ + /* and other stuff */ case 'r': if(browse_dir != NULL) calc_init(getpath(browse_dir->parent), browse_dir->parent); nonfo++; break; - - /* and other stuff */ case 'q': if(flags & BF_INFO) nonfo++; diff --git a/src/browser.h b/src/browser.h index f823947c25843e7444f44c8925c50f206f318863..c7fe1f57c030270c03492756436286856050b09b 100644 --- a/src/browser.h +++ b/src/browser.h @@ -26,7 +26,7 @@ #ifndef _browser_h #define _browser_h -#include "ncdu.h" +#include "global.h" int browse_key(int); void browse_draw(void); diff --git a/src/calc.c b/src/calc.c index df8a38ff7b29def752d11d31b8795f74c981b6c5..33db219afc9c0564a8c288b043bd6ab1c15a9022 100644 --- a/src/calc.c +++ b/src/calc.c @@ -23,12 +23,7 @@ */ -#include "ncdu.h" -#include "calc.h" -#include "exclude.h" -#include "util.h" -#include "browser.h" -#include "path.h" +#include "global.h" #include <string.h> #include <stdlib.h> diff --git a/src/calc.h b/src/calc.h index da75060eb6a24703018978b200ae9498eefb3eae..e2f11adffe9be6e4f40a73177a996a7c223f2fc8 100644 --- a/src/calc.h +++ b/src/calc.h @@ -26,7 +26,7 @@ #ifndef _calc_h #define _calc_h -#include "ncdu.h" +#include "global.h" extern char calc_smfs; /* stay on the same filesystem */ diff --git a/src/delete.c b/src/delete.c index 5e54d5394227a5eea29262ffb9742c0dd21f9c7a..ee95e54c096c06d89c153793c3934bce040596c9 100644 --- a/src/delete.c +++ b/src/delete.c @@ -24,10 +24,7 @@ */ -#include "ncdu.h" -#include "util.h" -#include "browser.h" -#include "path.h" +#include "global.h" #include <string.h> #include <errno.h> diff --git a/src/delete.h b/src/delete.h index 55991b79ea0d07ecd3291454119e26827d621d35..afcb733d21760800eafdb813488a726278b22500 100644 --- a/src/delete.h +++ b/src/delete.h @@ -26,7 +26,7 @@ #ifndef _delete_h #define _delete_h -#include "ncdu.h" +#include "global.h" void delete_process(void); int delete_key(int); diff --git a/src/ncdu.h b/src/global.h similarity index 91% rename from src/ncdu.h rename to src/global.h index 26a509501fb43870879b765a41a40fabfe51bbdd..4ccbcdf9ef6cb2e014b9622c76cc869b8fdd50dc 100644 --- a/src/ncdu.h +++ b/src/global.h @@ -23,8 +23,8 @@ */ -#ifndef _ncdu_h -#define _ncdu_h +#ifndef _global_h +#define _global_h #include "config.h" #include <stdio.h> @@ -84,4 +84,13 @@ extern long update_delay; int input_handle(int); +/* import all other global functions and variables */ +#include "exclude.h" +#include "util.h" +#include "calc.h" +#include "delete.h" +#include "browser.h" +#include "help.h" +#include "path.h" + #endif diff --git a/src/help.c b/src/help.c index 79d5bb77ae2b32a746452686a4070215fd0e0d99..01e9fa2ee95aa8c4f87a9a9caf300ba1afb31ca8 100644 --- a/src/help.c +++ b/src/help.c @@ -23,10 +23,7 @@ */ -#include "ncdu.h" -#include "help.h" -#include "browser.h" -#include "util.h" +#include "global.h" #include <ncurses.h> #include <string.h> diff --git a/src/help.h b/src/help.h index 96d8c8e97ce56430e007143f50b277b0151299d4..091560de40af24f3e390ac2089ef4e483b05e319 100644 --- a/src/help.h +++ b/src/help.h @@ -26,7 +26,7 @@ #ifndef _help_h #define _help_h -#include "ncdu.h" +#include "global.h" int help_key(int); void help_draw(void); diff --git a/src/main.c b/src/main.c index b13b55db37998a6ff1ab9430766a69a16755faf5..a31dfbe60d413ded65d480e54b1941273d23c357 100644 --- a/src/main.c +++ b/src/main.c @@ -23,14 +23,7 @@ */ -#include "ncdu.h" -#include "exclude.h" -#include "util.h" -#include "calc.h" -#include "delete.h" -#include "browser.h" -#include "help.h" -#include "path.h" +#include "global.h" #include <stdlib.h> #include <string.h> diff --git a/src/util.h b/src/util.h index 265f6fbfb02b55bc82d2c7ef1d1cf2a58dc5251c..e83c25e2aa07b78d5f2c868667c7ad311026ab3f 100644 --- a/src/util.h +++ b/src/util.h @@ -26,7 +26,7 @@ #ifndef _util_h #define _util_h -#include "ncdu.h" +#include "global.h" #include <ncurses.h> /* updated when window is resized */