mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
* src/info.c (info_show_info): Enabled display of the device number,
for the case that the column in the directory listing is too short. This had been disabled since 1994, for no obvious reason and without any comment. * src/screen.c (format_device_number): Added. Converts a device number into a bounded string. * screen.c (string_file_size): Support for larger device numbers (and for non-Linux systems). * vfs/cpio.c (cpio_read_crc_head): Fixed device number handling for non-Linux systems. * vfs/fish.c (fish_dir_load): Likewise. * vfs/utilvfs.c (vfs_parse_ls_lga): Likewise.
This commit is contained in:
parent
7a60de0618
commit
9558c7178f
5
NEWS
5
NEWS
@ -1,3 +1,8 @@
|
||||
Current
|
||||
|
||||
- Core functionality
|
||||
- Device numbers are displayed correctly.
|
||||
|
||||
Version 4.6.1-pre2.
|
||||
|
||||
Release candidate for 4.6.1.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2005-01-17 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* info.c (info_show_info): Enabled display of the device number,
|
||||
for the case that the column in the directory listing is too
|
||||
short. This had been disabled since 1994, for no obvious reason
|
||||
and without any comment.
|
||||
* screen.c (format_device_number): Added. Converts a device number
|
||||
into a bounded string.
|
||||
* screen.c (string_file_size): Support for larger device numbers
|
||||
(and for non-Linux systems).
|
||||
|
||||
2005-01-26 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* tty.h (printwstr): Added a function to print a string
|
||||
|
10
src/info.c
10
src/info.c
@ -34,6 +34,7 @@
|
||||
#include "layout.h"
|
||||
#include "key.h" /* is_idle() */
|
||||
#include "mountlist.h"
|
||||
#include "unixcompat.h"
|
||||
|
||||
#ifndef VERSION
|
||||
# define VERSION "undefined"
|
||||
@ -149,13 +150,12 @@ info_show_info (struct WInfo *info)
|
||||
|
||||
case 8:
|
||||
widget_move (&info->widget, 8, 3);
|
||||
#if 0
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
if (st.st_rdev)
|
||||
printw ("Inode dev: major: %d, minor: %d",
|
||||
st.st_rdev >> 8, st.st_rdev & 0xff);
|
||||
if (S_ISCHR (st.st_mode) || S_ISBLK(st.st_mode))
|
||||
printw ("Inode dev: major: %lu, minor: %lu",
|
||||
(unsigned long) major (st.st_rdev),
|
||||
(unsigned long) minor (st.st_rdev));
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
char buffer[10];
|
||||
|
30
src/screen.c
30
src/screen.c
@ -47,6 +47,7 @@
|
||||
#include "menu.h" /* menubar_visible */
|
||||
#define WANT_WIDGETS
|
||||
#include "main.h" /* the_menubar */
|
||||
#include "unixcompat.h"
|
||||
|
||||
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
|
||||
|
||||
@ -190,6 +191,31 @@ string_file_name (file_entry *fe, int len)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline int ilog10(dev_t n)
|
||||
{
|
||||
int digits = 0;
|
||||
do {
|
||||
digits++, n /= 10;
|
||||
} while (n != 0);
|
||||
return digits;
|
||||
}
|
||||
|
||||
static void format_device_number (char *buf, size_t bufsize, dev_t dev)
|
||||
{
|
||||
dev_t major_dev = major(dev);
|
||||
dev_t minor_dev = minor(dev);
|
||||
int major_digits = ilog10(major_dev);
|
||||
int minor_digits = ilog10(minor_dev);
|
||||
|
||||
g_assert(bufsize >= 1);
|
||||
if (major_digits + 1 + minor_digits + 1 <= bufsize) {
|
||||
g_snprintf(buf, bufsize, "%lu,%lu", (unsigned long) major_dev,
|
||||
(unsigned long) minor_dev);
|
||||
} else {
|
||||
g_strlcpy(buf, _("[dev]"), bufsize);
|
||||
}
|
||||
}
|
||||
|
||||
/* size */
|
||||
static const char *
|
||||
string_file_size (file_entry *fe, int len)
|
||||
@ -203,9 +229,7 @@ string_file_size (file_entry *fe, int len)
|
||||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
if (S_ISBLK (fe->st.st_mode) || S_ISCHR (fe->st.st_mode))
|
||||
g_snprintf (buffer, sizeof (buffer), "%3d,%3d",
|
||||
(int) ((fe->st.st_rdev >> 8) & 0xff),
|
||||
(int) (fe->st.st_rdev & 0xff));
|
||||
format_device_number (buffer, len + 1, fe->st.st_rdev);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-01-27 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* cpio.c (cpio_read_crc_head): Fixed device number handling for
|
||||
non-Linux systems.
|
||||
* fish.c (fish_dir_load): Likewise.
|
||||
* utilvfs.c (vfs_parse_ls_lga): Likewise.
|
||||
|
||||
2005-01-25 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* samba/Makefile.in: Remove BINDIR and SBINDIR.
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "vfs-impl.h"
|
||||
#include "gc.h" /* vfs_rmstamp */
|
||||
#include "xdirentry.h"
|
||||
#include "../src/unixcompat.h"
|
||||
|
||||
enum {
|
||||
STATUS_START,
|
||||
@ -415,13 +416,13 @@ static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
|
||||
return STATUS_TRAIL;
|
||||
}
|
||||
|
||||
u.st.st_dev = (hd.c_dev << 8) + hd.c_devmin;
|
||||
u.st.st_dev = makedev (hd.c_dev, hd.c_devmin);
|
||||
u.st.st_ino = hd.c_ino;
|
||||
u.st.st_mode = hd.c_mode;
|
||||
u.st.st_nlink = hd.c_nlink;
|
||||
u.st.st_uid = hd.c_uid;
|
||||
u.st.st_gid = hd.c_gid;
|
||||
u.st.st_rdev = (hd.c_rdev << 8) + hd.c_rdevmin;
|
||||
u.st.st_rdev = makedev (hd.c_rdev, hd.c_rdevmin);
|
||||
u.st.st_size = hd.c_filesize;
|
||||
u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "vfs-impl.h"
|
||||
#include "gc.h" /* vfs_stamp_create */
|
||||
#include "tcputil.h"
|
||||
#include "../src/unixcompat.h"
|
||||
|
||||
#define FISH_DIRECTORY_TIMEOUT 30 * 60
|
||||
|
||||
@ -461,7 +462,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
if (sscanf(buffer+1, "%d,%d", &maj, &min) != 2)
|
||||
break;
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
ST.st_rdev = (maj << 8) | min;
|
||||
ST.st_rdev = makedev (maj, min);
|
||||
#endif
|
||||
}
|
||||
case 'L': ent->ino->linkname = g_strdup(buffer+1);
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "utilvfs.h"
|
||||
#include "vfs.h"
|
||||
#include "../src/unixcompat.h"
|
||||
|
||||
/* Extract the hostname and username from the path */
|
||||
/* path is in the form: [user@]hostname:port/remote-dir, e.g.:
|
||||
@ -763,7 +764,7 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
|
||||
goto error;
|
||||
}
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
s->st_rdev = ((maj & 0xff) << 8) | (min & 0xffff00ff);
|
||||
s->st_rdev = makedev (maj, min);
|
||||
#endif
|
||||
s->st_size = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user