2007-07-20 03:15:46 -08:00
|
|
|
/* ncdu - NCurses Disk Usage
|
|
|
|
|
|
2009-01-11 00:34:19 -09:00
|
|
|
Copyright (c) 2007-2009 Yoran Heling
|
2007-07-20 03:15:46 -08:00
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included
|
|
|
|
|
in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2009-04-26 01:08:40 -08:00
|
|
|
#ifndef _global_h
|
|
|
|
|
#define _global_h
|
2007-07-20 03:15:46 -08:00
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/types.h>
|
2007-08-11 12:01:16 -08:00
|
|
|
|
2007-07-20 03:15:46 -08:00
|
|
|
/* File Flags (struct dir -> flags) */
|
2007-07-29 06:06:05 -08:00
|
|
|
#define FF_DIR 0x01
|
|
|
|
|
#define FF_FILE 0x02
|
|
|
|
|
#define FF_ERR 0x04 /* error while reading this item */
|
|
|
|
|
#define FF_OTHFS 0x08 /* excluded because it was an other filesystem */
|
|
|
|
|
#define FF_EXL 0x10 /* excluded using exlude patterns */
|
|
|
|
|
#define FF_SERR 0x20 /* error in subdirectory */
|
2009-05-05 09:25:52 -08:00
|
|
|
#define FF_HLNK 0x40 /* hard link (same file already encountered before) */
|
|
|
|
|
#define FF_BSEL 0x80 /* selected */
|
2007-07-20 03:15:46 -08:00
|
|
|
|
2009-04-11 03:47:55 -08:00
|
|
|
/* Program states */
|
2009-04-08 09:09:24 -08:00
|
|
|
#define ST_CALC 0
|
|
|
|
|
#define ST_BROWSE 1
|
|
|
|
|
#define ST_DEL 2
|
|
|
|
|
#define ST_HELP 3
|
2009-04-10 08:16:33 -08:00
|
|
|
#define ST_QUIT 4
|
2009-04-08 09:09:24 -08:00
|
|
|
|
2007-08-11 12:01:16 -08:00
|
|
|
|
2009-04-11 03:47:55 -08:00
|
|
|
/* structure representing a file or directory */
|
2007-07-20 03:15:46 -08:00
|
|
|
struct dir {
|
2007-07-26 08:37:33 -08:00
|
|
|
struct dir *parent, *next, *sub;
|
2009-04-10 08:16:33 -08:00
|
|
|
char *name;
|
2007-08-01 05:17:26 -08:00
|
|
|
off_t size, asize;
|
2007-08-11 12:01:16 -08:00
|
|
|
unsigned long items;
|
2007-08-01 05:17:26 -08:00
|
|
|
unsigned char flags;
|
|
|
|
|
};
|
2007-07-20 03:15:46 -08:00
|
|
|
|
2009-04-08 09:40:18 -08:00
|
|
|
/* program state */
|
2009-04-10 23:58:33 -08:00
|
|
|
extern int pstate;
|
2009-04-25 23:49:51 -08:00
|
|
|
/* minimum screen update interval when calculating, in ms */
|
|
|
|
|
extern long update_delay;
|
2007-07-20 03:15:46 -08:00
|
|
|
|
2009-04-11 03:47:55 -08:00
|
|
|
/* handle input from keyboard and update display */
|
2009-04-10 08:16:33 -08:00
|
|
|
int input_handle(int);
|
2009-04-11 01:37:45 -08:00
|
|
|
|
|
|
|
|
|
2009-04-26 01:08:40 -08:00
|
|
|
/* 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"
|
|
|
|
|
|
2009-04-11 01:37:45 -08:00
|
|
|
#endif
|