make option O_NOUG to compile out user group info

This commit is contained in:
Arun Prakash Jana 2020-10-31 21:22:01 +05:30
parent ff5685b64d
commit 0b31414c9a
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@ O_NERD := 0 # support icons-nerdfont
O_QSORT := 0 # use Alexey Tourbin's QSORT implementation O_QSORT := 0 # use Alexey Tourbin's QSORT implementation
O_BENCH := 0 # benchmark mode (stops at first user input) O_BENCH := 0 # benchmark mode (stops at first user input)
O_NOSSN := 0 # enable session support O_NOSSN := 0 # enable session support
O_NOUG := 0 # disable user, group name in status bar
# convert targets to flags for backwards compatibility # convert targets to flags for backwards compatibility
ifneq ($(filter debug,$(MAKECMDGOALS)),) ifneq ($(filter debug,$(MAKECMDGOALS)),)
@ -95,6 +96,10 @@ ifeq ($(O_NOSSN),1)
CPPFLAGS += -DNOSSN CPPFLAGS += -DNOSSN
endif endif
ifeq ($(O_NOUG),1)
CPPFLAGS += -DNOUG
endif
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw) CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw) LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)

View File

@ -252,8 +252,10 @@ typedef struct entry {
off_t size; off_t size;
blkcnt_t blocks; /* number of 512B blocks allocated */ blkcnt_t blocks; /* number of 512B blocks allocated */
mode_t mode; mode_t mode;
#ifndef NOUG
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
#endif
ushort nlen; /* Length of file name */ ushort nlen; /* Length of file name */
uchar flags; /* Flags specific to the file */ uchar flags; /* Flags specific to the file */
} *pEntry; } *pEntry;
@ -5103,8 +5105,11 @@ static int dentfill(char *path, struct entry **ppdents)
dentp->mode = sb.st_mode; dentp->mode = sb.st_mode;
dentp->size = sb.st_size; dentp->size = sb.st_size;
#endif #endif
#ifndef NOUG
dentp->uid = sb.st_uid; dentp->uid = sb.st_uid;
dentp->gid = sb.st_gid; dentp->gid = sb.st_gid;
#endif
dentp->flags = S_ISDIR(sb.st_mode) ? 0 : ((sb.st_nlink > 1) ? HARD_LINK : 0); dentp->flags = S_ISDIR(sb.st_mode) ? 0 : ((sb.st_nlink > 1) ? HARD_LINK : 0);
if (entflags) { if (entflags) {
@ -5578,6 +5583,7 @@ static void statusbar(char *path)
addch(' '); addch(' ');
addstr(get_lsperms(pent->mode)); addstr(get_lsperms(pent->mode));
addch(' '); addch(' ');
#ifndef NOUG
if (g_state.uidgid) { if (g_state.uidgid) {
struct passwd *pw = getpwuid(pent->uid); struct passwd *pw = getpwuid(pent->uid);
struct group *gr = getgrgid(pent->gid); struct group *gr = getgrgid(pent->gid);
@ -5594,6 +5600,7 @@ static void statusbar(char *path)
addch('-'); addch('-');
addch(' '); addch(' ');
} }
#endif
addstr(coolsize(pent->size)); addstr(coolsize(pent->size));
addch(' '); addch(' ');
addstr(ptr); addstr(ptr);
@ -7357,7 +7364,9 @@ static void usage(void)
" -t secs timeout to lock\n" " -t secs timeout to lock\n"
" -T key sort order [a/d/e/r/s/t/v]\n" " -T key sort order [a/d/e/r/s/t/v]\n"
" -u use selection (no prompt)\n" " -u use selection (no prompt)\n"
#ifndef NOUG
" -U show user and group\n" " -U show user and group\n"
#endif
" -V show version\n" " -V show version\n"
" -w place HW cursor on hovered\n" " -w place HW cursor on hovered\n"
" -x notis, sel to system clipboard\n" " -x notis, sel to system clipboard\n"