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
e5f290d7
Commit
e5f290d7
authored
1 year ago
by
Ing. Michal Svamberg
Browse files
Options
Downloads
Patches
Plain Diff
Uprava jednotek a pouziti apparent size pro pocitani souboru
parent
aa8bf925
No related branches found
Branches containing commit
Tags
v2.1.1
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/main.zig
+1
-1
1 addition, 1 deletion
src/main.zig
src/scan.zig
+4
-4
4 additions, 4 deletions
src/scan.zig
src/ui.zig
+15
-14
15 additions, 14 deletions
src/ui.zig
src/util.zig
+1
-2
1 addition, 2 deletions
src/util.zig
with
21 additions
and
21 deletions
src/main.zig
+
1
−
1
View file @
e5f290d7
...
...
@@ -291,7 +291,7 @@ fn tryReadArgsFile(path: [:0]const u8) void {
}
fn
version
()
noreturn
{
std
.
io
.
getStdOut
().
writer
().
writeAll
(
"nc
du
"
++
program_version
++
"
\n
"
)
catch
{};
std
.
io
.
getStdOut
().
writer
().
writeAll
(
"nc
cf
"
++
program_version
++
"
\n
"
)
catch
{};
std
.
process
.
exit
(
0
);
}
...
...
This diff is collapsed.
Click to expand it.
src/scan.zig
+
4
−
4
View file @
e5f290d7
...
...
@@ -8,7 +8,7 @@ const ui = @import("ui.zig");
const
util
=
@import
(
"util.zig"
);
const
exclude
=
@import
(
"exclude.zig"
);
const
c_statfs
=
@cImport
(
@cInclude
(
"sys/vfs.h"
));
var
count
size
:
u8
=
1
;
var
size
one
:
u8
=
1
;
// Concise stat struct for fields we're interested in, with the types used by the model.
const
Stat
=
struct
{
...
...
@@ -34,8 +34,8 @@ const Stat = struct {
fn
read
(
parent
:
std
.
fs
.
Dir
,
name
:
[:
0
]
const
u8
,
follow
:
bool
)
!
Stat
{
const
stat
=
try
std
.
os
.
fstatatZ
(
parent
.
fd
,
name
,
if
(
follow
)
0
else
std
.
os
.
AT
.
SYMLINK_NOFOLLOW
);
return
Stat
{
.
blocks
=
clamp
(
Stat
,
.
blocks
,
countsize
),
.
size
=
clamp
(
Stat
,
.
size
,
count
size
),
.
blocks
=
clamp
(
Stat
,
.
blocks
,
stat
.
blocks
),
.
size
=
clamp
(
Stat
,
.
size
,
siz
eon
e
),
.
dev
=
truncate
(
Stat
,
.
dev
,
stat
.
dev
),
.
ino
=
truncate
(
Stat
,
.
ino
,
stat
.
ino
),
.
nlink
=
clamp
(
Stat
,
.
nlink
,
stat
.
nlink
),
...
...
@@ -787,7 +787,7 @@ const Import = struct {
},
'd'
=>
{
if
(
eq
(
u8
,
key
,
"dsize"
))
{
self
.
ctx
.
stat
.
blocks
=
@intCast
(
model
.
Blocks
,
self
.
uint
(
u64
));
self
.
ctx
.
stat
.
blocks
=
@intCast
(
model
.
Blocks
,
self
.
uint
(
u64
)
>>
9
);
return
;
}
if
(
eq
(
u8
,
key
,
"dev"
))
{
...
...
This diff is collapsed.
Click to expand it.
src/ui.zig
+
15
−
14
View file @
e5f290d7
...
...
@@ -421,22 +421,22 @@ pub const FmtSize = struct {
var
r
:
@This
()
=
undefined
;
var
f
=
@intToFloat
(
f32
,
v
);
if
(
main
.
config
.
si
)
{
if
(
f
<
1000.0
)
{
r
.
unit
=
"
B
"
;
}
else
if
(
f
<
1e6
)
{
r
.
unit
=
" K
B
"
;
f
/=
1e3
;
}
else
if
(
f
<
1e9
)
{
r
.
unit
=
" M
B
"
;
f
/=
1e6
;
}
else
if
(
f
<
1e12
)
{
r
.
unit
=
" G
B
"
;
f
/=
1e9
;
}
else
if
(
f
<
1e15
)
{
r
.
unit
=
" T
B
"
;
f
/=
1e12
;
}
else
if
(
f
<
1e18
)
{
r
.
unit
=
" P
B
"
;
f
/=
1e15
;
}
else
{
r
.
unit
=
" E
B
"
;
f
/=
1e18
;
}
if
(
f
<
1000.0
)
{
r
.
unit
=
" "
;
}
else
if
(
f
<
1e6
)
{
r
.
unit
=
" K"
;
f
/=
1e3
;
}
else
if
(
f
<
1e9
)
{
r
.
unit
=
" M"
;
f
/=
1e6
;
}
else
if
(
f
<
1e12
)
{
r
.
unit
=
" G"
;
f
/=
1e9
;
}
else
if
(
f
<
1e15
)
{
r
.
unit
=
" T"
;
f
/=
1e12
;
}
else
if
(
f
<
1e18
)
{
r
.
unit
=
" P"
;
f
/=
1e15
;
}
else
{
r
.
unit
=
" E"
;
f
/=
1e18
;
}
}
else
{
if
(
f
<
1000.0
)
{
r
.
unit
=
"
B
"
;
}
else
if
(
f
<
1023e3
)
{
r
.
unit
=
" Ki
B
"
;
f
/=
1024.0
;
}
else
if
(
f
<
1023e6
)
{
r
.
unit
=
" Mi
B
"
;
f
/=
1048576.0
;
}
else
if
(
f
<
1023e9
)
{
r
.
unit
=
" Gi
B
"
;
f
/=
1073741824.0
;
}
else
if
(
f
<
1023e12
)
{
r
.
unit
=
" Ti
B
"
;
f
/=
1099511627776.0
;
}
else
if
(
f
<
1023e15
)
{
r
.
unit
=
" Pi
B
"
;
f
/=
1125899906842624.0
;
}
else
{
r
.
unit
=
" Ei
B
"
;
f
/=
1152921504606846976.0
;
}
if
(
f
<
1000.0
)
{
r
.
unit
=
" "
;
}
else
if
(
f
<
1023e3
)
{
r
.
unit
=
" Ki"
;
f
/=
1024.0
;
}
else
if
(
f
<
1023e6
)
{
r
.
unit
=
" Mi"
;
f
/=
1048576.0
;
}
else
if
(
f
<
1023e9
)
{
r
.
unit
=
" Gi"
;
f
/=
1073741824.0
;
}
else
if
(
f
<
1023e12
)
{
r
.
unit
=
" Ti"
;
f
/=
1099511627776.0
;
}
else
if
(
f
<
1023e15
)
{
r
.
unit
=
" Pi"
;
f
/=
1125899906842624.0
;
}
else
{
r
.
unit
=
" Ei"
;
f
/=
1152921504606846976.0
;
}
}
_
=
std
.
fmt
.
bufPrintZ
(
&
r
.
buf
,
"{d:>5.1}"
,
.
{
f
})
catch
unreachable
;
return
r
;
...
...
@@ -454,6 +454,7 @@ pub fn addsize(bg: Bg, v: u64) void {
addstr
(
r
.
num
());
bg
.
fg
(.
default
);
addstr
(
r
.
unit
);
addch
(
if
(
main
.
config
.
show_blocks
)
'B'
else
' '
);
}
// Print a full decimal number with thousand separators.
...
...
This diff is collapsed.
Click to expand it.
src/util.zig
+
1
−
2
View file @
e5f290d7
...
...
@@ -25,8 +25,7 @@ pub fn castTruncate(comptime T: type, x: anytype) T {
// Multiplies by 512, saturating.
pub
fn
blocksToSize
(
b
:
u64
)
u64
{
//return if (b & 0xFF80000000000000 > 0) std.math.maxInt(u64) else b << 9;
return
b
;
return
if
(
b
&
0xFF80000000000000
>
0
)
std
.
math
.
maxInt
(
u64
)
else
b
<<
9
;
}
// Ensure the given arraylist buffer gets zero-terminated and returns a slice
...
...
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