Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
3e6affa7
Commit
3e6affa7
authored
7 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Display extended information in the info window
It's looking a bit cramped, but I'm lazy.
parent
1165342d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/browser.c
+21
-3
21 additions, 3 deletions
src/browser.c
src/dir_mem.c
+4
-3
4 additions, 3 deletions
src/dir_mem.c
src/util.c
+24
-0
24 additions, 0 deletions
src/util.c
src/util.h
+3
-0
3 additions, 0 deletions
src/util.h
with
52 additions
and
6 deletions
src/browser.c
+
21
−
3
View file @
3e6affa7
...
...
@@ -28,6 +28,7 @@
#include
<string.h>
#include
<stdlib.h>
#include
<ncurses.h>
#include
<time.h>
static
int
graph
=
1
,
show_as
=
0
,
info_show
=
0
,
info_page
=
0
,
info_start
=
0
,
show_items
=
0
;
...
...
@@ -37,6 +38,8 @@ static char *message = NULL;
static
void
browse_draw_info
(
struct
dir
*
dr
)
{
struct
dir
*
t
;
struct
dir_ext
*
e
=
dir_ext_ptr
(
dr
);
char
mbuf
[
46
];
int
i
;
nccreate
(
11
,
60
,
"Item info"
);
...
...
@@ -51,15 +54,30 @@ static void browse_draw_info(struct dir *dr) {
attron
(
A_BOLD
);
ncaddstr
(
2
,
3
,
"Name:"
);
ncaddstr
(
3
,
3
,
"Path:"
);
ncaddstr
(
4
,
3
,
"Type:"
);
if
(
!
e
)
ncaddstr
(
4
,
3
,
"Type:"
);
else
{
ncaddstr
(
4
,
3
,
"Mode:"
);
ncaddstr
(
4
,
21
,
"UID:"
);
ncaddstr
(
4
,
33
,
"GID:"
);
ncaddstr
(
5
,
3
,
"Last modified:"
);
}
ncaddstr
(
6
,
3
,
" Disk usage:"
);
ncaddstr
(
7
,
3
,
"Apparent size:"
);
attroff
(
A_BOLD
);
ncaddstr
(
2
,
9
,
cropstr
(
dr
->
name
,
49
));
ncaddstr
(
3
,
9
,
cropstr
(
getpath
(
dr
->
parent
),
49
));
ncaddstr
(
4
,
9
,
dr
->
flags
&
FF_DIR
?
"Directory"
:
dr
->
flags
&
FF_FILE
?
"File"
:
"Other (link, device, socket, ..)"
);
ncaddstr
(
4
,
9
,
dr
->
flags
&
FF_DIR
?
"Directory"
:
dr
->
flags
&
FF_FILE
?
"File"
:
"Other"
);
if
(
e
)
{
ncaddstr
(
4
,
9
,
fmtmode
(
e
->
mode
));
ncprint
(
4
,
26
,
"%d"
,
e
->
uid
);
ncprint
(
4
,
38
,
"%d"
,
e
->
gid
);
time_t
t
=
(
time_t
)
e
->
mtime
;
strftime
(
mbuf
,
sizeof
(
mbuf
),
"%Y-%m-%d %H:%M:%S %z"
,
localtime
(
&
t
));
ncaddstr
(
5
,
18
,
mbuf
);
}
ncmove
(
6
,
18
);
printsize
(
UIC_DEFAULT
,
dr
->
size
);
...
...
This diff is collapsed.
Click to expand it.
src/dir_mem.c
+
4
−
3
View file @
3e6affa7
...
...
@@ -123,11 +123,12 @@ static int item(struct dir *dir, const char *name, struct dir_ext *ext) {
if
(
!
root
&&
orig
)
name
=
orig
->
name
;
int
extended
=
extended_info
&&
(
dir
->
flags
&
FF_EXT
);
item
=
malloc
(
extended
?
dir_ext_memsize
(
name
)
:
dir_memsize
(
name
));
if
(
!
extended_info
)
dir
->
flags
&=
~
FF_EXT
;
item
=
malloc
(
dir
->
flags
&
FF_EXT
?
dir_ext_memsize
(
name
)
:
dir_memsize
(
name
));
memcpy
(
item
,
dir
,
offsetof
(
struct
dir
,
name
));
strcpy
(
item
->
name
,
name
);
if
(
extended
)
if
(
dir
->
flags
&
FF_EXT
)
memcpy
(
dir_ext_ptr
(
item
),
ext
,
sizeof
(
struct
dir_ext
));
item_add
(
item
);
...
...
This diff is collapsed.
Click to expand it.
src/util.c
+
24
−
0
View file @
3e6affa7
...
...
@@ -121,6 +121,30 @@ char *fullsize(int64_t from) {
}
char
*
fmtmode
(
unsigned
short
mode
)
{
static
char
buf
[
11
];
unsigned
short
ft
=
mode
&
S_IFMT
;
buf
[
0
]
=
ft
==
S_IFDIR
?
'd'
:
ft
==
S_IFREG
?
'-'
:
ft
==
S_IFLNK
?
'l'
:
ft
==
S_IFIFO
?
'p'
:
ft
==
S_IFSOCK
?
's'
:
ft
==
S_IFCHR
?
'c'
:
ft
==
S_IFBLK
?
'b'
:
'?'
;
buf
[
1
]
=
mode
&
0400
?
'r'
:
'-'
;
buf
[
2
]
=
mode
&
0200
?
'w'
:
'-'
;
buf
[
3
]
=
mode
&
0100
?
'x'
:
'-'
;
buf
[
4
]
=
mode
&
0040
?
'r'
:
'-'
;
buf
[
5
]
=
mode
&
0020
?
'w'
:
'-'
;
buf
[
6
]
=
mode
&
0010
?
'x'
:
'-'
;
buf
[
7
]
=
mode
&
0004
?
'r'
:
'-'
;
buf
[
8
]
=
mode
&
0002
?
'w'
:
'-'
;
buf
[
9
]
=
mode
&
0001
?
'x'
:
'-'
;
buf
[
10
]
=
0
;
return
buf
;
}
void
read_locale
()
{
thou_sep
=
'.'
;
#ifdef HAVE_LOCALE_H
...
...
This diff is collapsed.
Click to expand it.
src/util.h
+
3
−
0
View file @
3e6affa7
...
...
@@ -137,6 +137,9 @@ void printsize(enum ui_coltype, int64_t);
/* int2string with thousand separators */
char
*
fullsize
(
int64_t
);
/* format's a file mode as a ls -l string */
char
*
fmtmode
(
unsigned
short
);
/* read locale information from the environment */
void
read_locale
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment