mc/src/dir.h
Slava Zanko 2ebdf91079 Merge branch 'm-utf-8'
* m-utf-8: (223 commits)
  Fix wildcard pattern in file select and file find dialogs
  Project builds with option --disable-charsets
  Deleted build-glib1.sh because glib1 don't work with utf-8
  fix building without --enable-charset
  Total replacement to mc_search stuff in all places
  Search engine: if found_len parameter NULL, then mc_search_run don't try to fill them
  src/view.c: Reworked search stuff to usage src/search
  refactoring: rename edit/editcmd_dialog.c:editcmd_dialog__get_search_types_list to
  Search engine: development of hex search complete
  Search engine: remove forgotten debug string and reindent file
  Search engine:
  configure.ac: if present glib-2.14 and higher, libpcre don't linked
  Search engine: now used regexp external engines:
  src/find.c: Fixed core dump if content search pattern no present
  edit/editcmd_dialogs.c: fixed state of search type between dialog window calls
  Find files: checkbox 'Regular expression' for content search now default unchecked
  Find files: changes for usage of new search engine:
  Fix copy of current/opposite path to command line: remove charset info from path
  src/Makefile.am: add some header files to Make-tracking
  Fixed editor menu reloading.
2009-05-07 13:01:01 +03:00

88 lines
2.5 KiB
C

/** \file dir.h
* \brief Header: directory routines
*/
#ifndef MC_DIR_H
#define MC_DIR_H
#define MIN_FILES 128
#define RESIZE_STEPS 128
#include <sys/stat.h>
/* keys are set only during sorting */
typedef struct {
/* File attributes */
int fnamelen;
char *fname;
struct stat st;
/* key used for comparing names */
char *sort_key;
/* key used for comparing extensions */
char *second_sort_key;
/* Flags */
struct {
unsigned int marked:1; /* File marked in pane window */
unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
unsigned int stale_link:1; /* If this is a symlink and points to Charon's land */
unsigned int dir_size_computed:1; /* Size of directory was computed with dirsizes_cmd */
} f;
} file_entry;
typedef struct {
file_entry *list;
int size;
} dir_list;
typedef int sortfn (const void *, const void *);
int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
int case_sensitive, int exec_ff, const char *filter);
void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
int case_sensitive, int exec_ff);
int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
int reverse, int case_sensitive, int exec_ff, const char *filter);
void clean_dir (dir_list * list, int count);
int set_zero_dir (dir_list * list);
int handle_path (dir_list *list, const char *path, struct stat *buf1,
int next_free, int *link_to_dir, int *stale_link);
/* Sorting functions */
int unsorted (file_entry *a, file_entry *b);
int sort_name (file_entry *a, file_entry *b);
int sort_ext (file_entry *a, file_entry *b);
int sort_time (file_entry *a, file_entry *b);
int sort_atime (file_entry *a, file_entry *b);
int sort_ctime (file_entry *a, file_entry *b);
int sort_size (file_entry *a, file_entry *b);
int sort_inode (file_entry *a, file_entry *b);
/* SORT_TYPES is used to build the nice dialog box entries */
#define SORT_TYPES 8
/* This is the number of sort types not available in that dialog box */
#define SORT_TYPES_EXTRA 0
/* The total nnumber of sort types */
#define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
typedef struct {
const char *sort_name;
int (*sort_fn)(file_entry *, file_entry *);
} sort_orders_t;
extern sort_orders_t sort_orders [SORT_TYPES_TOTAL];
int link_isdir (const file_entry *);
int if_link_is_exe (const char *full_name, const file_entry *file);
extern int show_backups;
extern int show_dot_files;
extern int mix_all_files;
#endif