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
43fec632
Commit
43fec632
authored
16 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Removed last occurence of PATH_MAX
And it wasn't even used for a path, but for a row on the screen...
parent
290c7a7d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/browser.c
+19
-15
19 additions, 15 deletions
src/browser.c
src/global.h
+0
-19
0 additions, 19 deletions
src/global.h
with
19 additions
and
34 deletions
src/browser.c
+
19
−
15
View file @
43fec632
...
@@ -151,7 +151,7 @@ void browse_draw_info(struct dir *dr) {
...
@@ -151,7 +151,7 @@ void browse_draw_info(struct dir *dr) {
void
browse_draw_item
(
struct
dir
*
n
,
int
row
,
off_t
max
,
int
ispar
)
{
void
browse_draw_item
(
struct
dir
*
n
,
int
row
,
off_t
max
,
int
ispar
)
{
char
tmp
[
1000
]
,
ct
,
dt
,
*
size
,
gr
[
11
];
char
*
line
,
ct
,
dt
,
*
size
,
gr
[
11
];
int
i
,
o
;
int
i
,
o
;
float
pc
;
float
pc
;
...
@@ -194,23 +194,25 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) {
...
@@ -194,23 +194,25 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) {
}
}
/* format and add item to the list */
/* format and add item to the list */
line
=
malloc
(
winrows
+
1
);
switch
(
graph
)
{
switch
(
graph
)
{
case
0
:
case
0
:
sprintf
(
tmp
,
"%%c %%7s %%c%%-%ds"
,
wincols
-
12
);
sprintf
(
line
,
"%%c %%7s %%c%%-%ds"
,
wincols
-
12
);
mvprintw
(
row
,
0
,
tmp
,
ct
,
size
,
dt
,
cropstr
(
n
->
name
,
wincols
-
12
));
mvprintw
(
row
,
0
,
line
,
ct
,
size
,
dt
,
cropstr
(
n
->
name
,
wincols
-
12
));
break
;
break
;
case
1
:
case
1
:
sprintf
(
tmp
,
"%%c %%7s [%%10s] %%c%%-%ds"
,
wincols
-
24
);
sprintf
(
line
,
"%%c %%7s [%%10s] %%c%%-%ds"
,
wincols
-
24
);
mvprintw
(
row
,
0
,
tmp
,
ct
,
size
,
gr
,
dt
,
cropstr
(
n
->
name
,
wincols
-
24
));
mvprintw
(
row
,
0
,
line
,
ct
,
size
,
gr
,
dt
,
cropstr
(
n
->
name
,
wincols
-
24
));
break
;
break
;
case
2
:
case
2
:
sprintf
(
tmp
,
"%%c %%7s [%%4.1f%%%%] %%c%%-%ds"
,
wincols
-
19
);
sprintf
(
line
,
"%%c %%7s [%%4.1f%%%%] %%c%%-%ds"
,
wincols
-
19
);
mvprintw
(
row
,
0
,
tmp
,
ct
,
size
,
pc
,
dt
,
cropstr
(
n
->
name
,
wincols
-
19
));
mvprintw
(
row
,
0
,
line
,
ct
,
size
,
pc
,
dt
,
cropstr
(
n
->
name
,
wincols
-
19
));
break
;
break
;
case
3
:
case
3
:
sprintf
(
tmp
,
"%%c %%7s [%%4.1f%%%% %%10s] %%c%%-%ds"
,
wincols
-
30
);
sprintf
(
line
,
"%%c %%7s [%%4.1f%%%% %%10s] %%c%%-%ds"
,
wincols
-
30
);
mvprintw
(
row
,
0
,
tmp
,
ct
,
size
,
pc
,
gr
,
dt
,
cropstr
(
n
->
name
,
wincols
-
30
));
mvprintw
(
row
,
0
,
line
,
ct
,
size
,
pc
,
gr
,
dt
,
cropstr
(
n
->
name
,
wincols
-
30
));
}
}
free
(
line
);
if
(
n
->
flags
&
FF_BSEL
)
if
(
n
->
flags
&
FF_BSEL
)
attroff
(
A_REVERSE
);
attroff
(
A_REVERSE
);
...
@@ -219,7 +221,7 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) {
...
@@ -219,7 +221,7 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) {
void
browse_draw
()
{
void
browse_draw
()
{
struct
dir
*
n
,
ref
,
*
cur
,
*
sel
=
NULL
;
struct
dir
*
n
,
ref
,
*
cur
,
*
sel
=
NULL
;
char
tmp
[
PATH_MAX
]
,
*
tmp
2
;
char
*
line
,
*
tmp
;
int
selected
,
i
;
int
selected
,
i
;
off_t
max
=
1
;
off_t
max
=
1
;
...
@@ -233,9 +235,11 @@ void browse_draw() {
...
@@ -233,9 +235,11 @@ void browse_draw() {
mvprintw
(
0
,
0
,
"%s %s ~ Use the arrow keys to navigate, press ? for help"
,
PACKAGE_NAME
,
PACKAGE_VERSION
);
mvprintw
(
0
,
0
,
"%s %s ~ Use the arrow keys to navigate, press ? for help"
,
PACKAGE_NAME
,
PACKAGE_VERSION
);
if
(
cur
)
{
if
(
cur
)
{
strcpy
(
tmp
,
formatsize
(
cur
->
parent
->
size
));
line
=
malloc
(
winrows
+
1
);
strcpy
(
line
,
formatsize
(
cur
->
parent
->
size
));
mvprintw
(
winrows
-
1
,
0
,
" Total disk usage: %s Apparent size: %s Items: %d"
,
mvprintw
(
winrows
-
1
,
0
,
" Total disk usage: %s Apparent size: %s Items: %d"
,
tmp
,
formatsize
(
cur
->
parent
->
asize
),
cur
->
parent
->
items
);
line
,
formatsize
(
cur
->
parent
->
asize
),
cur
->
parent
->
items
);
free
(
line
);
}
else
}
else
mvaddstr
(
winrows
-
1
,
0
,
" No items to display."
);
mvaddstr
(
winrows
-
1
,
0
,
" No items to display."
);
attroff
(
A_REVERSE
);
attroff
(
A_REVERSE
);
...
@@ -243,9 +247,9 @@ void browse_draw() {
...
@@ -243,9 +247,9 @@ void browse_draw() {
mvhline
(
1
,
0
,
'-'
,
wincols
);
mvhline
(
1
,
0
,
'-'
,
wincols
);
if
(
cur
)
{
if
(
cur
)
{
mvaddch
(
1
,
3
,
' '
);
mvaddch
(
1
,
3
,
' '
);
tmp
2
=
getpath
(
cur
->
parent
);
tmp
=
getpath
(
cur
->
parent
);
mvaddstr
(
1
,
4
,
cropstr
(
tmp
2
,
wincols
-
8
));
mvaddstr
(
1
,
4
,
cropstr
(
tmp
,
wincols
-
8
));
mvaddch
(
1
,
4
+
((
int
)
strlen
(
tmp
2
)
>
wincols
-
8
?
wincols
-
8
:
(
int
)
strlen
(
tmp
2
)),
' '
);
mvaddch
(
1
,
4
+
((
int
)
strlen
(
tmp
)
>
wincols
-
8
?
wincols
-
8
:
(
int
)
strlen
(
tmp
)),
' '
);
}
}
if
(
!
cur
)
if
(
!
cur
)
...
...
This diff is collapsed.
Click to expand it.
src/global.h
+
0
−
19
View file @
43fec632
...
@@ -29,25 +29,6 @@
...
@@ -29,25 +29,6 @@
#include
"config.h"
#include
"config.h"
#include
<stdio.h>
#include
<stdio.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<limits.h>
/* PATH_MAX 260 on Cygwin is too small for /proc/registry */
#ifdef __CYGWIN__
# if PATH_MAX < 1024
# undef PATH_MAX
# define PATH_MAX 1024
# endif
#endif
/* get PATH_MAX */
#ifndef PATH_MAX
# ifdef _POSIX_PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
# else
# define PATH_MAX 4096
# endif
#endif
/* File Flags (struct dir -> flags) */
/* File Flags (struct dir -> flags) */
#define FF_DIR 0x01
#define FF_DIR 0x01
...
...
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