From 6eef826c60239733a4f2eaea4ead26be102523df Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 21 Aug 2008 07:07:23 +0000 Subject: [PATCH] Synced -lsl display of major,minor numbers with /usr/include/sys/sysmacros.h --- xorriso/xorriso.c | 12 ++++++++++-- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 72fffd26..f0fc57c2 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -6882,6 +6882,7 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag) int show_major_minor= 0; char *rpt, perms[10], mm_text[80]; mode_t st_mode; + dev_t dev, major, minor; rpt= xorriso->result_line; rpt[0]= 0; @@ -6914,8 +6915,15 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag) sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_uid); sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_gid); if(show_major_minor) { - sprintf(mm_text, "%d,%d", (int) ((stbuf->st_rdev>>8)&0xfff), - (int) (((stbuf->st_rdev&~0xfffff)>>12) | (stbuf->st_rdev&0xff))); + dev= stbuf->st_rdev; + + /* according to /usr/include/sys/sysmacros.h : gnu_dev_major(),_minor() + >>> but this looks should go to some system dependency */ + major= (((dev >> 8) & 0xfff) | ((unsigned int) (dev >> 32) & ~0xfff)) + & 0xffffffff; + minor= (((dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff))) & 0xffffffff; + + sprintf(mm_text, "%u,%u", (unsigned int) major, (unsigned int) minor); sprintf(rpt+strlen(rpt), "%8s ", mm_text); } else sprintf(rpt+strlen(rpt), "%8.f ", (double) stbuf->st_size); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 5945fa85..3f7218ae 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.08.20.181734" +#define Xorriso_timestamP "2008.08.21.070602"