Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7bfe6a33
Commit
7bfe6a33
authored
Dec 22, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/run_storage: add command "stat"
parent
9a577f80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
run_storage.cxx
test/run_storage.cxx
+35
-0
No files found.
test/run_storage.cxx
View file @
7bfe6a33
...
...
@@ -90,6 +90,29 @@ Ls(Storage &storage, const char *path)
return
EXIT_SUCCESS
;
}
static
int
Stat
(
Storage
&
storage
,
const
char
*
path
)
{
const
auto
info
=
storage
.
GetInfo
(
path
,
false
);
switch
(
info
.
type
)
{
case
StorageFileInfo
:
:
Type
::
OTHER
:
printf
(
"other
\n
"
);
break
;
case
StorageFileInfo
:
:
Type
::
REGULAR
:
printf
(
"regular
\n
"
);
break
;
case
StorageFileInfo
:
:
Type
::
DIRECTORY
:
printf
(
"directory
\n
"
);
break
;
}
printf
(
"size: %llu
\n
"
,
(
unsigned
long
long
)
info
.
size
);
return
EXIT_SUCCESS
;
}
int
main
(
int
argc
,
char
**
argv
)
try
{
...
...
@@ -117,6 +140,18 @@ try {
storage_uri
);
return
Ls
(
*
storage
,
path
);
}
else
if
(
strcmp
(
command
,
"stat"
)
==
0
)
{
if
(
argc
!=
4
)
{
fprintf
(
stderr
,
"Usage: run_storage stat URI PATH
\n
"
);
return
EXIT_FAILURE
;
}
const
char
*
const
path
=
argv
[
3
];
auto
storage
=
MakeStorage
(
io_thread
.
GetEventLoop
(),
storage_uri
);
return
Stat
(
*
storage
,
path
);
}
else
{
fprintf
(
stderr
,
"Unknown command
\n
"
);
return
EXIT_FAILURE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment