* src/dir.h (sort_type): Remove function declaration.
(sort_links): Likewise. (sort_nuid): Likewise. (sort_ngid): Likewise. (sort_owner): Likewise. (sort_group): Likewise. * src/dir.c (sort_type): Remove function definition. (sort_links): Likewise. (sort_nuid): Likewise. (sort_ngid): Likewise. (sort_owner): Likewise. (sort_group): Likewise. (sort_orders): Reflect the changes above. * src/screen.c (formats): Remove references to sort_type(), sort_links(), sort_nuid(), sort_ngid(), sort_owner() and sort_group().
Этот коммит содержится в:
родитель
59d63bca65
Коммит
bc146822b0
@ -1,3 +1,21 @@
|
||||
2007-01-14 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* dir.h (sort_type): Remove function declaration.
|
||||
(sort_links): Likewise.
|
||||
(sort_nuid): Likewise.
|
||||
(sort_ngid): Likewise.
|
||||
(sort_owner): Likewise.
|
||||
(sort_group): Likewise.
|
||||
* dir.c (sort_type): Remove function definition.
|
||||
(sort_links): Likewise.
|
||||
(sort_nuid): Likewise.
|
||||
(sort_ngid): Likewise.
|
||||
(sort_owner): Likewise.
|
||||
(sort_group): Likewise.
|
||||
(sort_orders): Reflect the changes above.
|
||||
* screen.c (formats): Remove references to sort_type(), sort_links(),
|
||||
sort_nuid(), sort_ngid(), sort_owner() and sort_group().
|
||||
|
||||
2007-01-02 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* utilunix.c (mc_tmpdir): Call mc_mkstemps() with an absolute
|
||||
|
105
src/dir.c
105
src/dir.c
@ -56,14 +56,6 @@ sort_orders_t sort_orders [SORT_TYPES_TOTAL] = {
|
||||
{ N_("C&Hange time"), sort_ctime },
|
||||
{ N_("&Size"), sort_size },
|
||||
{ N_("&Inode"), sort_inode },
|
||||
|
||||
/* New sort orders */
|
||||
{ N_("&Type"), sort_type },
|
||||
{ N_("&Links"), sort_links },
|
||||
{ N_("N&GID"), sort_ngid },
|
||||
{ N_("N&UID"), sort_nuid },
|
||||
{ N_("&Owner"), sort_owner },
|
||||
{ N_("&Group"), sort_group }
|
||||
};
|
||||
|
||||
#ifdef HAVE_STRCOLL
|
||||
@ -147,28 +139,6 @@ sort_ext (const file_entry *a, const file_entry *b)
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
int
|
||||
sort_owner (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return string_sortcomp (get_owner (a->st.st_uid), get_owner (a->st.st_uid)) * reverse;
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
int
|
||||
sort_group (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return string_sortcomp (get_group (a->st.st_gid), get_group (a->st.st_gid)) * reverse;
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
int
|
||||
sort_time (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
@ -229,81 +199,6 @@ sort_size (const file_entry *a, const file_entry *b)
|
||||
return (2 * (b->st.st_size > a->st.st_size) - 1) * reverse;
|
||||
}
|
||||
|
||||
int
|
||||
sort_links (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return (b->st.st_nlink - a->st.st_nlink) * reverse;
|
||||
else
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
int
|
||||
sort_ngid (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return (b->st.st_gid - a->st.st_gid) * reverse;
|
||||
else
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
int
|
||||
sort_nuid (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return (b->st.st_uid - a->st.st_uid) * reverse;
|
||||
else
|
||||
return bd-ad;
|
||||
}
|
||||
|
||||
inline static int
|
||||
file_type_to_num (const file_entry *fe)
|
||||
{
|
||||
const struct stat *s = &fe->st;
|
||||
|
||||
if (S_ISDIR (s->st_mode))
|
||||
return 0;
|
||||
if (S_ISLNK (s->st_mode)){
|
||||
if (fe->f.link_to_dir)
|
||||
return 1;
|
||||
if (fe->f.stale_link)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
if (S_ISSOCK (s->st_mode))
|
||||
return 4;
|
||||
if (S_ISCHR (s->st_mode))
|
||||
return 5;
|
||||
if (S_ISBLK (s->st_mode))
|
||||
return 6;
|
||||
if (S_ISFIFO (s->st_mode))
|
||||
return 7;
|
||||
if (S_ISNAM (s->st_mode)) /* Special named files will be shown as block devices */
|
||||
return 6;
|
||||
if (is_exe (s->st_mode))
|
||||
return 8;
|
||||
return 9;
|
||||
}
|
||||
|
||||
int
|
||||
sort_type (const file_entry *a, const file_entry *b)
|
||||
{
|
||||
int aa = file_type_to_num (a);
|
||||
int bb = file_type_to_num (b);
|
||||
|
||||
return bb-aa;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
do_sort (dir_list *list, sortfn *sort, int top, int reverse_f, int case_sensitive_f)
|
||||
|
@ -50,18 +50,12 @@ int sort_atime (const file_entry *a, const file_entry *b);
|
||||
int sort_ctime (const file_entry *a, const file_entry *b);
|
||||
int sort_size (const file_entry *a, const file_entry *b);
|
||||
int sort_inode (const file_entry *a, const file_entry *b);
|
||||
int sort_type (const file_entry *a, const file_entry *b);
|
||||
int sort_links (const file_entry *a, const file_entry *b);
|
||||
int sort_nuid (const file_entry *a, const file_entry *b);
|
||||
int sort_ngid (const file_entry *a, const file_entry *b);
|
||||
int sort_owner (const file_entry *a, const file_entry *b);
|
||||
int sort_group (const file_entry *a, const 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 6
|
||||
#define SORT_TYPES_EXTRA 0
|
||||
|
||||
/* The total nnumber of sort types */
|
||||
#define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
|
||||
|
14
src/screen.c
14
src/screen.c
@ -427,23 +427,23 @@ static struct {
|
||||
const char *title;
|
||||
int use_in_gui;
|
||||
const char *(*string_fn)(file_entry *, int);
|
||||
sortfn *sort_routine;
|
||||
sortfn *sort_routine; /* This field is currently unused. */
|
||||
} formats [] = {
|
||||
{ "name", 12, 1, J_LEFT_FIT, N_("Name"), 1, string_file_name, (sortfn *) sort_name },
|
||||
{ "size", 7, 0, J_RIGHT, N_("Size"), 1, string_file_size, (sortfn *) sort_size },
|
||||
{ "bsize", 7, 0, J_RIGHT, N_("Size"), 1, string_file_size_brief, (sortfn *) sort_size },
|
||||
{ "type", GT, 0, J_LEFT, "", 2, string_file_type, (sortfn *) sort_type },
|
||||
{ "type", GT, 0, J_LEFT, "", 2, string_file_type, NULL },
|
||||
{ "mtime", 12, 0, J_RIGHT, N_("MTime"), 1, string_file_mtime, (sortfn *) sort_time },
|
||||
{ "atime", 12, 0, J_RIGHT, N_("ATime"), 1, string_file_atime, (sortfn *) sort_atime },
|
||||
{ "ctime", 12, 0, J_RIGHT, N_("CTime"), 1, string_file_ctime, (sortfn *) sort_ctime },
|
||||
{ "perm", 10, 0, J_LEFT, N_("Permission"),1,string_file_permission, NULL },
|
||||
{ "mode", 6, 0, J_RIGHT, N_("Perm"), 1, string_file_perm_octal, NULL },
|
||||
{ "nlink", 2, 0, J_RIGHT, N_("Nl"), 1, string_file_nlinks, (sortfn *) sort_links },
|
||||
{ "nlink", 2, 0, J_RIGHT, N_("Nl"), 1, string_file_nlinks, NULL },
|
||||
{ "inode", 5, 0, J_RIGHT, N_("Inode"), 1, string_inode, (sortfn *) sort_inode },
|
||||
{ "nuid", 5, 0, J_RIGHT, N_("UID"), 1, string_file_nuid, (sortfn *) sort_nuid },
|
||||
{ "ngid", 5, 0, J_RIGHT, N_("GID"), 1, string_file_ngid, (sortfn *) sort_ngid },
|
||||
{ "owner", 8, 0, J_LEFT_FIT, N_("Owner"), 1, string_file_owner, (sortfn *) sort_owner },
|
||||
{ "group", 8, 0, J_LEFT_FIT, N_("Group"), 1, string_file_group, (sortfn *) sort_group },
|
||||
{ "nuid", 5, 0, J_RIGHT, N_("UID"), 1, string_file_nuid, NULL },
|
||||
{ "ngid", 5, 0, J_RIGHT, N_("GID"), 1, string_file_ngid, NULL },
|
||||
{ "owner", 8, 0, J_LEFT_FIT, N_("Owner"), 1, string_file_owner, NULL },
|
||||
{ "group", 8, 0, J_LEFT_FIT, N_("Group"), 1, string_file_group, NULL },
|
||||
{ "mark", 1, 0, J_RIGHT, " ", 1, string_marked, NULL },
|
||||
{ "|", 1, 0, J_RIGHT, " ", 0, NULL, NULL },
|
||||
{ "space", 1, 0, J_RIGHT, " ", 0, string_space, NULL },
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user