* dir.h (file_entry): Rename "buf" to "st". Adjust all

dependencies.
This commit is contained in:
Pavel Roskin 2003-08-18 00:47:43 +00:00
parent c90321d4b4
commit 4dd13a09ba
11 changed files with 120 additions and 115 deletions

View File

@ -1,3 +1,8 @@
2003-08-17 Pavel Roskin <proski@gnu.org>
* dir.h (file_entry): Rename "buf" to "st". Adjust all
dependencies.
2003-08-01 Pavel Roskin <proski@gnu.org>
* main.c: Rename PanelMenu to LeftMenu. Don't assume that

View File

@ -174,7 +174,7 @@ static int scan_for_file (WPanel *panel, int idx, int direction)
i = panel->count - 1;
if (i == panel->count)
i = 0;
if (!S_ISDIR (panel->dir.list [i].buf.st_mode))
if (!S_ISDIR (panel->dir.list [i].st.st_mode))
return i;
i += direction;
}
@ -191,7 +191,7 @@ do_view_cmd (int normal)
int dir, file_idx;
/* Directories are viewed by changing to them */
if (S_ISDIR (selection (cpanel)->buf.st_mode)
if (S_ISDIR (selection (cpanel)->st.st_mode)
|| link_isdir (selection (cpanel))) {
if (confirm_view_dir && (cpanel->marked || cpanel->dirs_marked)) {
if (query_dialog
@ -459,7 +459,7 @@ void reverse_selection_cmd (void)
for (i = 0; i < cpanel->count; i++){
file = &cpanel->dir.list [i];
if (S_ISDIR (file->buf.st_mode))
if (S_ISDIR (file->st.st_mode))
continue;
do_file_mark (cpanel, i, !file->f.marked);
}
@ -492,7 +492,7 @@ void select_cmd (void)
for (i = 0; i < cpanel->count; i++){
if (!strcmp (cpanel->dir.list [i].fname, ".."))
continue;
if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
if (S_ISDIR (cpanel->dir.list [i].st.st_mode)){
if (!dirflag)
continue;
} else {
@ -538,7 +538,7 @@ void unselect_cmd (void)
for (i = 0; i < cpanel->count; i++){
if (!strcmp (cpanel->dir.list [i].fname, ".."))
continue;
if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
if (S_ISDIR (cpanel->dir.list [i].st.st_mode)){
if (!dirflag)
continue;
} else {
@ -794,7 +794,7 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
file_mark (panel, i, 0);
/* Skip directories */
if (S_ISDIR (source->buf.st_mode))
if (S_ISDIR (source->st.st_mode))
continue;
/* Search the corresponding entry from the other panel */
@ -812,12 +812,12 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
if (mode != compare_size_only){
/* Older version is not marked */
if (source->buf.st_mtime < target->buf.st_mtime)
if (source->st.st_mtime < target->st.st_mtime)
continue;
}
/* Newer version with different size is marked */
if (source->buf.st_size != target->buf.st_size){
if (source->st.st_size != target->st.st_size){
do_file_mark (panel, i, 1);
continue;
@ -828,7 +828,7 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
if (mode == compare_quick){
/* Thorough compare off, compare only time stamps */
/* Mark newer version, don't mark version with the same date */
if (source->buf.st_mtime > target->buf.st_mtime){
if (source->st.st_mtime > target->st.st_mtime){
do_file_mark (panel, i, 1);
}
continue;
@ -837,7 +837,7 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
/* Thorough compare on, do byte-by-byte comparison */
src_name = concat_dir_and_file (panel->cwd, source->fname);
dst_name = concat_dir_and_file (other->cwd, target->fname);
if (compare_files (src_name, dst_name, source->buf.st_size))
if (compare_files (src_name, dst_name, source->st.st_size))
do_file_mark (panel, i, 1);
g_free (src_name);
g_free (dst_name);
@ -1004,7 +1004,7 @@ void symlink_cmd (void)
void edit_symlink_cmd (void)
{
if (S_ISLNK (selection (cpanel)->buf.st_mode)) {
if (S_ISLNK (selection (cpanel)->st.st_mode)) {
char buffer [MC_MAXPATHLEN];
char *p = NULL;
int i;
@ -1244,13 +1244,13 @@ dirsizes_cmd (void)
double total;
for (i = 0; i < panel->count; i++)
if (S_ISDIR (panel->dir.list [i].buf.st_mode) &&
if (S_ISDIR (panel->dir.list [i].st.st_mode) &&
((panel->dirs_marked && panel->dir.list [i].f.marked) ||
!panel->dirs_marked) &&
strcmp (panel->dir.list [i].fname, "..") != 0) {
total = 0.0l;
compute_dir_size (panel->dir.list [i].fname, &marked, &total);
panel->dir.list [i].buf.st_size = (off_t) total;
panel->dir.list [i].st.st_size = (off_t) total;
panel->dir.list [i].f.dir_size_computed = 1;
}

View File

@ -44,7 +44,7 @@ static int reverse = 1;
/* Are the files sorted case sensitively? */
static int case_sensitive = OS_SORT_CASE_SENSITIVE_DEFAULT;
#define MY_ISDIR(x) ( (S_ISDIR (x->buf.st_mode) || x->f.link_to_dir) ? 1 : 0)
#define MY_ISDIR(x) ( (S_ISDIR (x->st.st_mode) || x->f.link_to_dir) ? 1 : 0)
sort_orders_t sort_orders [SORT_TYPES_TOTAL] = {
{ N_("&Unsorted"), unsorted },
@ -151,7 +151,7 @@ sort_owner (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return string_sortcomp (get_owner (a->buf.st_uid), get_owner (a->buf.st_uid)) * reverse;
return string_sortcomp (get_owner (a->st.st_uid), get_owner (a->st.st_uid)) * reverse;
return bd-ad;
}
@ -162,7 +162,7 @@ sort_group (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return string_sortcomp (get_group (a->buf.st_gid), get_group (a->buf.st_gid)) * reverse;
return string_sortcomp (get_group (a->st.st_gid), get_group (a->st.st_gid)) * reverse;
return bd-ad;
}
@ -173,7 +173,7 @@ sort_time (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (a->buf.st_mtime - b->buf.st_mtime) * reverse;
return (a->st.st_mtime - b->st.st_mtime) * reverse;
else
return bd-ad;
}
@ -185,7 +185,7 @@ sort_ctime (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (a->buf.st_ctime - b->buf.st_ctime) * reverse;
return (a->st.st_ctime - b->st.st_ctime) * reverse;
else
return bd-ad;
}
@ -197,7 +197,7 @@ sort_atime (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (a->buf.st_atime - b->buf.st_atime) * reverse;
return (a->st.st_atime - b->st.st_atime) * reverse;
else
return bd-ad;
}
@ -209,7 +209,7 @@ sort_inode (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (a->buf.st_ino - b->buf.st_ino) * reverse;
return (a->st.st_ino - b->st.st_ino) * reverse;
else
return bd-ad;
}
@ -223,7 +223,7 @@ sort_size (const file_entry *a, const file_entry *b)
if (ad != bd && !mix_all_files)
return bd - ad;
return (2 * (b->buf.st_size > a->buf.st_size) - 1) * reverse;
return (2 * (b->st.st_size > a->st.st_size) - 1) * reverse;
}
int
@ -233,7 +233,7 @@ sort_links (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (b->buf.st_nlink - a->buf.st_nlink) * reverse;
return (b->st.st_nlink - a->st.st_nlink) * reverse;
else
return bd-ad;
}
@ -245,7 +245,7 @@ sort_ngid (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (b->buf.st_gid - a->buf.st_gid) * reverse;
return (b->st.st_gid - a->st.st_gid) * reverse;
else
return bd-ad;
}
@ -257,7 +257,7 @@ sort_nuid (const file_entry *a, const file_entry *b)
int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files)
return (b->buf.st_uid - a->buf.st_uid) * reverse;
return (b->st.st_uid - a->st.st_uid) * reverse;
else
return bd-ad;
}
@ -265,7 +265,7 @@ sort_nuid (const file_entry *a, const file_entry *b)
inline static int
file_type_to_num (const file_entry *fe)
{
const struct stat *s = &fe->buf;
const struct stat *s = &fe->st;
if (S_ISDIR (s->st_mode))
return 0;
@ -355,7 +355,7 @@ add_dotdot_to_list (dir_list *list, int index)
(list->list) [index].f.stale_link = 0;
(list->list) [index].f.dir_size_computed = 0;
(list->list) [index].f.marked = 0;
(list->list) [index].buf.st_mode = 040755;
(list->list) [index].st.st_mode = 040755;
return 1;
}
@ -469,7 +469,7 @@ do_load_dir (char *path, dir_list *list, sortfn *sort, int reverse,
struct dirent *dp;
int status, link_to_dir, stale_link;
int next_free = 0;
struct stat buf;
struct stat st;
tree_store_start_check_cwd ();
@ -481,7 +481,7 @@ do_load_dir (char *path, dir_list *list, sortfn *sort, int reverse,
}
for (dp = mc_readdir (dirp); dp; dp = mc_readdir (dirp)) {
status =
handle_dirent (list, filter, dp, &buf, next_free, &link_to_dir,
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0)
continue;
@ -496,7 +496,7 @@ do_load_dir (char *path, dir_list *list, sortfn *sort, int reverse,
list->list[next_free].f.link_to_dir = link_to_dir;
list->list[next_free].f.stale_link = stale_link;
list->list[next_free].f.dir_size_computed = 0;
list->list[next_free].buf = buf;
list->list[next_free].st = st;
next_free++;
if (!(next_free % 32))
rotate_dash ();
@ -532,7 +532,7 @@ if_link_is_exe (char *full_name, file_entry *file)
{
struct stat b;
if (S_ISLNK (file->buf.st_mode)) {
if (S_ISLNK (file->st.st_mode)) {
mc_stat (full_name, &b);
return is_exe (b.st_mode);
} else
@ -574,7 +574,7 @@ do_reload_dir (char *path, dir_list *list, sortfn *sort, int count,
struct dirent *dp;
int next_free = 0;
int i, status, link_to_dir, stale_link;
struct stat buf;
struct stat st;
int marked_cnt;
GHashTable *marked_files = g_hash_table_new (g_str_hash, g_str_equal);
@ -605,7 +605,7 @@ do_reload_dir (char *path, dir_list *list, sortfn *sort, int count,
for (dp = mc_readdir (dirp); dp; dp = mc_readdir (dirp)) {
status =
handle_dirent (list, filter, dp, &buf, next_free, &link_to_dir,
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0)
continue;
@ -646,7 +646,7 @@ do_reload_dir (char *path, dir_list *list, sortfn *sort, int count,
list->list[next_free].f.link_to_dir = link_to_dir;
list->list[next_free].f.stale_link = stale_link;
list->list[next_free].f.dir_size_computed = 0;
list->list[next_free].buf = buf;
list->list[next_free].st = st;
next_free++;
if (!(next_free % 16))
rotate_dash ();

View File

@ -11,7 +11,7 @@ typedef struct {
int fnamelen;
char *fname;
struct stat buf;
struct stat st;
/* Flags */
struct {

View File

@ -1548,11 +1548,11 @@ panel_get_file (WPanel *panel, struct stat *stat_buf)
if (panel->marked) {
for (i = 0; i < panel->count; i++)
if (panel->dir.list[i].f.marked) {
*stat_buf = panel->dir.list[i].buf;
*stat_buf = panel->dir.list[i].st;
return panel->dir.list[i].fname;
}
} else {
*stat_buf = panel->dir.list[panel->selected].buf;
*stat_buf = panel->dir.list[panel->selected].st;
return panel->dir.list[panel->selected].fname;
}
g_assert_not_reached ();
@ -1634,7 +1634,7 @@ panel_compute_totals (WPanel *panel, off_t *ret_marked, double *ret_total)
if (!panel->dir.list[i].f.marked)
continue;
s = &panel->dir.list[i].buf;
s = &panel->dir.list[i].st;
if (S_ISDIR (s->st_mode)) {
char *dir_name;
@ -2014,7 +2014,7 @@ panel_operate (void *source_panel, FileOperation operation,
continue; /* Skip the unmarked ones */
source = panel->dir.list[i].fname;
src_stat = panel->dir.list[i].buf;
src_stat = panel->dir.list[i].st;
#ifdef WITH_FULL_PATHS
if (source_with_path)

View File

@ -900,7 +900,7 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname, char
int status, link_to_dir, stale_link;
int next_free = 0;
int i;
struct stat buf;
struct stat st;
WLEntry *entry = find_list->list;
dir_list *list = &cpanel->dir;
char *dir, *name;
@ -923,7 +923,7 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname, char
name = concat_dir_and_file (dir + 2, filename);
else
name = concat_dir_and_file (dir, filename);
status = handle_path (list, name, &buf, next_free, &link_to_dir,
status = handle_path (list, name, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0) {
g_free (name);
@ -950,7 +950,7 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname, char
list->list [next_free].f.link_to_dir = link_to_dir;
list->list [next_free].f.stale_link = stale_link;
list->list [next_free].f.dir_size_computed = 0;
list->list [next_free].buf = buf;
list->list [next_free].st = st;
next_free++;
if (!(next_free & 15))
rotate_dash ();

View File

@ -63,7 +63,7 @@ info_show_info (WInfo *info)
static int i18n_adjust=0;
static char *file_label;
struct stat buf;
struct stat st;
if (!is_idle ())
return;
@ -82,8 +82,8 @@ info_show_info (WInfo *info)
return;
my_statfs (&myfs_stats, cpanel->cwd);
buf = cpanel->dir.list [cpanel->selected].buf;
st = cpanel->dir.list [cpanel->selected].st;
/* Print only lines which fit */
if(!i18n_adjust) {
@ -137,53 +137,53 @@ info_show_info (WInfo *info)
case 11:
widget_move (&info->widget, 11, 3);
printw (_("Accessed: %s"), file_date (buf.st_atime));
printw (_("Accessed: %s"), file_date (st.st_atime));
case 10:
widget_move (&info->widget, 10, 3);
printw (_("Modified: %s"), file_date (buf.st_mtime));
printw (_("Modified: %s"), file_date (st.st_mtime));
case 9:
widget_move (&info->widget, 9, 3);
printw (_("Created: %s"), file_date (buf.st_ctime));
printw (_("Created: %s"), file_date (st.st_ctime));
case 8:
widget_move (&info->widget, 8, 3);
#if 0
#ifdef HAVE_ST_RDEV
if (buf.st_rdev)
if (st.st_rdev)
printw ("Inode dev: major: %d, minor: %d",
buf.st_rdev >> 8, buf.st_rdev & 0xff);
st.st_rdev >> 8, st.st_rdev & 0xff);
else
#endif
#endif
{
char buffer[10];
size_trunc_len(buffer, 9, buf.st_size, 0);
size_trunc_len(buffer, 9, st.st_size, 0);
printw (_("Size: %s"), buffer);
#ifdef HAVE_ST_BLOCKS
printw ((buf.st_blocks==1) ?
_(" (%d block)") : _(" (%d blocks)"), buf.st_blocks);
printw ((st.st_blocks==1) ?
_(" (%d block)") : _(" (%d blocks)"), st.st_blocks);
#endif
}
case 7:
widget_move (&info->widget, 7, 3);
printw (_("Owner: %s/%s"), get_owner (buf.st_uid),
get_group (buf.st_gid));
printw (_("Owner: %s/%s"), get_owner (st.st_uid),
get_group (st.st_gid));
case 6:
widget_move (&info->widget, 6, 3);
printw (_("Links: %d"), (int) buf.st_nlink);
printw (_("Links: %d"), (int) st.st_nlink);
case 5:
widget_move (&info->widget, 5, 3);
printw (_("Mode: %s (%04o)"),
string_perm (buf.st_mode), buf.st_mode & 07777);
string_perm (st.st_mode), st.st_mode & 07777);
case 4:
widget_move (&info->widget, 4, 3);
printw (_("Location: %Xh:%Xh"), (int)buf.st_dev, (int)buf.st_ino);
printw (_("Location: %Xh:%Xh"), (int)st.st_dev, (int)st.st_ino);
case 3:
widget_move (&info->widget, 3, 2);

View File

@ -308,7 +308,7 @@ reload_panelized (WPanel *panel)
*/
do_file_mark (panel, i, 0);
}
if (mc_lstat (list->list[i].fname, &list->list[i].buf)) {
if (mc_lstat (list->list[i].fname, &list->list[i].st)) {
g_free (list->list[i].fname);
continue;
}
@ -755,7 +755,7 @@ maybe_cd (int char_code, int move_up_dir)
do_cd ("..", cd_exact);
return 1;
}
if (S_ISDIR (selection (cpanel)->buf.st_mode)
if (S_ISDIR (selection (cpanel)->st.st_mode)
|| link_isdir (selection (cpanel))) {
do_cd (selection (cpanel)->fname, cd_exact);
return 1;
@ -1137,7 +1137,7 @@ copy_readlink (WPanel *panel)
{
if (!command_prompt)
return;
if (S_ISLNK (selection (panel)->buf.st_mode)) {
if (S_ISLNK (selection (panel)->st.st_mode)) {
char buffer[MC_MAXPATHLEN];
char *p =
concat_dir_and_file (panel->cwd, selection (panel)->fname);

View File

@ -356,7 +356,7 @@ void do_external_panelize (char *command)
{
int status, link_to_dir, stale_link;
int next_free = 0;
struct stat buf;
struct stat st;
dir_list *list = &cpanel->dir;
char line [MC_MAXPATHLEN];
char *name;
@ -387,7 +387,7 @@ void do_external_panelize (char *command)
name = line + 2;
else
name = line;
status = handle_path (list, name, &buf, next_free, &link_to_dir,
status = handle_path (list, name, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0)
continue;
@ -399,7 +399,7 @@ void do_external_panelize (char *command)
list->list [next_free].f.link_to_dir = link_to_dir;
list->list [next_free].f.stale_link = stale_link;
list->list [next_free].f.dir_size_computed = 0;
list->list [next_free].buf = buf;
list->list [next_free].st = st;
next_free++;
if (!(next_free & 32))
rotate_dash ();

View File

@ -137,7 +137,7 @@ add_permission_string (char *dest, int width, file_entry *fe, int attr, int colo
{
int i, r, l;
l = get_user_permissions (&fe->buf);
l = get_user_permissions (&fe->st);
if (is_octal){
/* Place of the access bit in octal mode */
@ -200,14 +200,14 @@ string_file_size (file_entry *fe, int len)
}
#ifdef HAVE_ST_RDEV
if (S_ISBLK (fe->buf.st_mode) || S_ISCHR (fe->buf.st_mode))
if (S_ISBLK (fe->st.st_mode) || S_ISCHR (fe->st.st_mode))
g_snprintf (buffer, sizeof (buffer), "%3d,%3d",
(int) ((fe->buf.st_rdev >> 8) & 0xff),
(int) (fe->buf.st_rdev & 0xff));
(int) ((fe->st.st_rdev >> 8) & 0xff),
(int) (fe->st.st_rdev & 0xff));
else
#endif
{
size_trunc_len (buffer, len, fe->buf.st_size, 0);
size_trunc_len (buffer, len, fe->st.st_size, 0);
}
return buffer;
}
@ -216,11 +216,11 @@ string_file_size (file_entry *fe, int len)
static const char *
string_file_size_brief (file_entry *fe, int len)
{
if (S_ISLNK (fe->buf.st_mode) && !fe->f.link_to_dir) {
if (S_ISLNK (fe->st.st_mode) && !fe->f.link_to_dir) {
return _("SYMLINK");
}
if ((S_ISDIR (fe->buf.st_mode) || fe->f.link_to_dir) && strcmp (fe->fname, "..")) {
if ((S_ISDIR (fe->st.st_mode) || fe->f.link_to_dir) && strcmp (fe->fname, "..")) {
return _("SUB-DIR");
}
@ -234,28 +234,28 @@ string_file_type (file_entry *fe, int len)
{
static char buffer[2];
if (S_ISDIR (fe->buf.st_mode))
if (S_ISDIR (fe->st.st_mode))
buffer[0] = PATH_SEP;
else if (S_ISLNK (fe->buf.st_mode)) {
else if (S_ISLNK (fe->st.st_mode)) {
if (fe->f.link_to_dir)
buffer[0] = '~';
else if (fe->f.stale_link)
buffer[0] = '!';
else
buffer[0] = '@';
} else if (S_ISCHR (fe->buf.st_mode))
} else if (S_ISCHR (fe->st.st_mode))
buffer[0] = '-';
else if (S_ISSOCK (fe->buf.st_mode))
else if (S_ISSOCK (fe->st.st_mode))
buffer[0] = '=';
else if (S_ISDOOR (fe->buf.st_mode))
else if (S_ISDOOR (fe->st.st_mode))
buffer[0] = '>';
else if (S_ISBLK (fe->buf.st_mode))
else if (S_ISBLK (fe->st.st_mode))
buffer[0] = '+';
else if (S_ISFIFO (fe->buf.st_mode))
else if (S_ISFIFO (fe->st.st_mode))
buffer[0] = '|';
else if (!S_ISREG (fe->buf.st_mode))
else if (!S_ISREG (fe->st.st_mode))
buffer[0] = '?'; /* non-regular of unknown kind */
else if (is_exe (fe->buf.st_mode))
else if (is_exe (fe->st.st_mode))
buffer[0] = '*';
else
buffer[0] = ' ';
@ -270,7 +270,7 @@ string_file_mtime (file_entry *fe, int len)
if (!strcmp (fe->fname, "..")) {
return "";
}
return file_date (fe->buf.st_mtime);
return file_date (fe->st.st_mtime);
}
/* atime */
@ -280,7 +280,7 @@ string_file_atime (file_entry *fe, int len)
if (!strcmp (fe->fname, "..")) {
return "";
}
return file_date (fe->buf.st_atime);
return file_date (fe->st.st_atime);
}
/* ctime */
@ -290,14 +290,14 @@ string_file_ctime (file_entry *fe, int len)
if (!strcmp (fe->fname, "..")) {
return "";
}
return file_date (fe->buf.st_ctime);
return file_date (fe->st.st_ctime);
}
/* perm */
static const char *
string_file_permission (file_entry *fe, int len)
{
return string_perm (fe->buf.st_mode);
return string_perm (fe->st.st_mode);
}
/* mode */
@ -306,7 +306,7 @@ string_file_perm_octal (file_entry *fe, int len)
{
static char buffer [10];
g_snprintf (buffer, sizeof (buffer), "0%06o", fe->buf.st_mode);
g_snprintf (buffer, sizeof (buffer), "0%06o", fe->st.st_mode);
return buffer;
}
@ -316,7 +316,7 @@ string_file_nlinks (file_entry *fe, int len)
{
static char buffer[BUF_TINY];
g_snprintf (buffer, sizeof (buffer), "%16d", (int) fe->buf.st_nlink);
g_snprintf (buffer, sizeof (buffer), "%16d", (int) fe->st.st_nlink);
return buffer;
}
@ -327,7 +327,7 @@ string_inode (file_entry *fe, int len)
static char buffer [10];
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->buf.st_ino);
(unsigned long) fe->st.st_ino);
return buffer;
}
@ -338,7 +338,7 @@ string_file_nuid (file_entry *fe, int len)
static char buffer [10];
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->buf.st_uid);
(unsigned long) fe->st.st_uid);
return buffer;
}
@ -349,7 +349,7 @@ string_file_ngid (file_entry *fe, int len)
static char buffer [10];
g_snprintf (buffer, sizeof (buffer), "%lu",
(unsigned long) fe->buf.st_gid);
(unsigned long) fe->st.st_gid);
return buffer;
}
@ -357,14 +357,14 @@ string_file_ngid (file_entry *fe, int len)
static const char *
string_file_owner (file_entry *fe, int len)
{
return get_owner (fe->buf.st_uid);
return get_owner (fe->st.st_uid);
}
/* group */
static const char *
string_file_group (file_entry *fe, int len)
{
return get_group (fe->buf.st_gid);
return get_group (fe->st.st_gid);
}
/* mark */
@ -476,28 +476,28 @@ file_compute_color (int attr, file_entry *fe)
}
/* if filetype_mode == true */
if (S_ISDIR (fe->buf.st_mode))
if (S_ISDIR (fe->st.st_mode))
return (DIRECTORY_COLOR);
else if (S_ISLNK (fe->buf.st_mode)) {
else if (S_ISLNK (fe->st.st_mode)) {
if (fe->f.link_to_dir)
return (DIRECTORY_COLOR);
else if (fe->f.stale_link)
return (STALE_LINK_COLOR);
else
return (LINK_COLOR);
} else if (S_ISSOCK (fe->buf.st_mode))
} else if (S_ISSOCK (fe->st.st_mode))
return (SPECIAL_COLOR);
else if (S_ISCHR (fe->buf.st_mode))
else if (S_ISCHR (fe->st.st_mode))
return (DEVICE_COLOR);
else if (S_ISBLK (fe->buf.st_mode))
else if (S_ISBLK (fe->st.st_mode))
return (DEVICE_COLOR);
else if (S_ISFIFO (fe->buf.st_mode))
else if (S_ISFIFO (fe->st.st_mode))
return (SPECIAL_COLOR);
else if (S_ISDOOR (fe->buf.st_mode))
else if (S_ISDOOR (fe->st.st_mode))
return (SPECIAL_COLOR);
else if (!S_ISREG (fe->buf.st_mode))
else if (!S_ISREG (fe->st.st_mode))
return (STALE_LINK_COLOR); /* non-regular file of unknown kind */
else if (is_exe (fe->buf.st_mode))
else if (is_exe (fe->st.st_mode))
return (EXECUTABLE_COLOR);
else if (fe->fname && (!strcmp (fe->fname, "core")
|| !strcmp (extension (fe->fname), "core")))
@ -664,7 +664,7 @@ display_mini_info (WPanel *panel)
/* Status resolves links and show them */
set_colors (panel);
if (S_ISLNK (panel->dir.list [panel->selected].buf.st_mode)){
if (S_ISLNK (panel->dir.list [panel->selected].st.st_mode)){
char *link, link_target [MC_MAXPATHLEN];
int len;
@ -1696,7 +1696,7 @@ next_page (WPanel *panel)
static void
ctrl_next_page (WPanel *panel)
{
if ((S_ISDIR (selection (panel)->buf.st_mode)
if ((S_ISDIR (selection (panel)->st.st_mode)
|| link_isdir (selection (panel)))) {
do_cd (selection (panel)->fname, cd_exact);
}
@ -1815,20 +1815,20 @@ do_file_mark (WPanel *panel, int idx, int mark)
file_mark (panel, idx, mark);
if (panel->dir.list [idx].f.marked){
panel->marked++;
if (S_ISDIR (panel->dir.list [idx].buf.st_mode)) {
if (S_ISDIR (panel->dir.list [idx].st.st_mode)) {
if (panel->dir.list [idx].f.dir_size_computed)
panel->total += panel->dir.list [idx].buf.st_size;
panel->total += panel->dir.list [idx].st.st_size;
panel->dirs_marked++;
} else
panel->total += panel->dir.list [idx].buf.st_size;
panel->total += panel->dir.list [idx].st.st_size;
set_colors (panel);
} else {
if (S_ISDIR(panel->dir.list [idx].buf.st_mode)) {
if (S_ISDIR(panel->dir.list [idx].st.st_mode)) {
if (panel->dir.list [idx].f.dir_size_computed)
panel->total -= panel->dir.list [idx].buf.st_size;
panel->total -= panel->dir.list [idx].st.st_size;
panel->dirs_marked--;
} else
panel->total -= panel->dir.list [idx].buf.st_size;
panel->total -= panel->dir.list [idx].st.st_size;
panel->marked--;
}
}
@ -1925,8 +1925,8 @@ do_enter_on_file_entry (file_entry *fe)
* Directory or link to directory - change directory.
* Try the same for the entries on which mc_lstat() has failed.
*/
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)
|| (fe->buf.st_mode == 0)) {
if (S_ISDIR (fe->st.st_mode) || link_isdir (fe)
|| (fe->st.st_mode == 0)) {
if (!do_cd (fe->fname, cd_exact))
message (1, MSG_ERROR, _("Cannot change directory"));
return 1;
@ -1938,7 +1938,7 @@ do_enter_on_file_entry (file_entry *fe)
/* Check if the file is executable */
full_name = concat_dir_and_file (cpanel->cwd, fe->fname);
if (!is_exe (fe->buf.st_mode) || !if_link_is_exe (full_name, fe)) {
if (!is_exe (fe->st.st_mode) || !if_link_is_exe (full_name, fe)) {
g_free (full_name);
return 0;
}
@ -2010,18 +2010,18 @@ chdir_to_readlink (WPanel *panel)
if (get_other_type () != view_listing)
return;
if (S_ISLNK (panel->dir.list [panel->selected].buf.st_mode)) {
if (S_ISLNK (panel->dir.list [panel->selected].st.st_mode)) {
char buffer [MC_MAXPATHLEN], *p;
int i;
struct stat mybuf;
struct stat st;
i = readlink (selection (panel)->fname, buffer, MC_MAXPATHLEN);
if (i < 0)
return;
if (mc_stat (selection (panel)->fname, &mybuf) < 0)
if (mc_stat (selection (panel)->fname, &st) < 0)
return;
buffer [i] = 0;
if (!S_ISDIR (mybuf.st_mode)) {
if (!S_ISDIR (st.st_mode)) {
p = strrchr (buffer, PATH_SEP);
if (p && !p[1]) {
*p = 0;

View File

@ -319,7 +319,7 @@ static char *extract_arg (char *p, char *arg)
static int test_type (WPanel *panel, char *arg)
{
int result = 0; /* False by default */
int st_mode = panel->dir.list [panel->selected].buf.st_mode;
int st_mode = panel->dir.list [panel->selected].st.st_mode;
for (;*arg != 0; arg++){
switch (*arg){