diff options
author | Yorhel <git@yorhel.nl> | 2009-04-11 13:47:55 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-04-11 13:49:08 +0200 |
commit | 690eb3f5930079698f2e318c8be29fd6ef0c0a71 (patch) | |
tree | be68538de1522f093721d7b50737da5ba6e4d0bc | |
parent | fa90c77c9608987f809105553c03fe95f35f5955 (diff) |
Header file cleanup
Moved everything that doesn't belong in ncdu.h into the other header
or c files. Looks much better this way.
-rw-r--r-- | src/calc.c | 12 | ||||
-rw-r--r-- | src/calc.h | 2 | ||||
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/ncdu.h | 51 | ||||
-rw-r--r-- | src/util.h | 1 |
5 files changed, 25 insertions, 52 deletions
@@ -28,6 +28,16 @@ #include "exclude.h" #include "util.h" +#include <string.h> +#include <stdlib.h> +#include <errno.h> + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <dirent.h> + struct state_calc stcalc; @@ -276,7 +286,7 @@ void calc_draw_progress() { char ani[15]; int i; - nccreate(10, 60, dat == NULL ? "Calculating..." : "Recalculating..."); + nccreate(10, 60, stcalc.sterr == ST_QUIT ? "Calculating..." : "Recalculating..."); ncprint(2, 2, "Total items: %-8d size: %s", stcalc.parent->items, formatsize(stcalc.parent->size, sflags & SF_SI)); @@ -26,6 +26,8 @@ #ifndef _calc_h #define _calc_h +#include "ncdu.h" + struct state_calc { char err; /* 1/0, error or not */ char cur[PATH_MAX]; /* current dir/item */ @@ -26,9 +26,14 @@ #include "ncdu.h" #include "exclude.h" #include "util.h" +#include "calc.h" + +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <unistd.h> -/* check ncdu.h what these are for */ -struct dir *dat; int sflags, bflags, sdelay, bgraph; int pstate; @@ -129,8 +134,6 @@ void argv_parse(int argc, char **argv, char *dir) { /* main program */ int main(int argc, char **argv) { - dat = NULL; - argv_parse(argc, argv, stcalc.cur); pstate = ST_CALC; stcalc.sterr = ST_QUIT; @@ -27,25 +27,8 @@ #define _ncdu_h #include "config.h" - #include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <ctype.h> -#include <limits.h> -#include <errno.h> - -#include <ncurses.h> -#include <form.h> - -#include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <dirent.h> - -#include "calc.h" /* set S_BLKSIZE if not defined already in sys/stat.h */ #ifndef S_BLKSIZE @@ -85,10 +68,6 @@ #endif - -/* - * G L O B A L F L A G S - */ /* File Flags (struct dir -> flags) */ #define FF_DIR 0x01 #define FF_FILE 0x02 @@ -115,7 +94,7 @@ #define BF_AS 0x40 /* show apparent sizes instead of disk usage */ #define BF_INFO 0x80 /* show file information window */ -/* States */ +/* Program states */ #define ST_CALC 0 #define ST_BROWSE 1 #define ST_DEL 2 @@ -123,10 +102,7 @@ #define ST_QUIT 4 - -/* - * S T R U C T U R E S - */ +/* structure representing a file or directory */ struct dir { struct dir *parent, *next, *sub; char *name; @@ -135,33 +111,14 @@ struct dir { unsigned char flags; }; - - -/* - * G L O B A L V A R I A B L E S - * - * (all defined in main.c) - */ -/* main directory data */ -extern struct dir *dat; /* global settings */ extern int sflags, bflags, sdelay, bgraph; + /* program state */ extern int pstate; - -/* - * G L O B A L F U N C T I O N S - */ -/* main.c */ +/* handle input from keyboard and update display */ int input_handle(int); -/* browser.c */ -void drawBrowser(int); -void showBrowser(void); -/* help.c */ -void showHelp(void); -/* delete.c */ -struct dir *showDelete(struct dir *); #endif @@ -27,6 +27,7 @@ #define _util_h #include "ncdu.h" +#include <ncurses.h> /* updated when window is resized */ extern int winrows, wincols; |