Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
bdf2e060
Commit
bdf2e060
authored
Nov 23, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish implementation of "cli help"
parent
bc7ac9c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
b00008.vtc
bin/varnishtest/tests/b00008.vtc
+2
-0
vcli_serve.c
lib/libvarnish/vcli_serve.c
+19
-14
No files found.
bin/varnishtest/tests/b00008.vtc
View file @
bdf2e060
...
...
@@ -10,6 +10,8 @@ varnish v1 -cliok "help -a"
varnish v1 -cliok "help -d"
varnish v1 -clierr 101 "help -x"
varnish v1 -cliok "help vcl.load"
varnish v1 -clierr 101 "help ban"
...
...
lib/libvarnish/vcli_serve.c
View file @
bdf2e060
...
...
@@ -120,25 +120,30 @@ void v_matchproto_(cli_func_t)
VCLS_func_help
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
struct
cli_proto
*
clp
;
unsigned
all
,
debug
,
d
;
unsigned
all
=
0
,
debug
=
0
,
d
;
struct
VCLS
*
cs
;
(
void
)
priv
;
cs
=
cli
->
cls
;
CHECK_OBJ_NOTNULL
(
cs
,
VCLS_MAGIC
);
if
(
av
[
2
]
==
NULL
)
{
all
=
debug
=
0
;
}
else
if
(
!
strcmp
(
av
[
2
],
"-a"
))
{
all
=
1
;
debug
=
0
;
}
else
if
(
!
strcmp
(
av
[
2
],
"-d"
))
{
all
=
0
;
debug
=
1
;
}
else
{
for
(
av
+=
2
;
av
[
0
]
!=
NULL
&&
av
[
0
][
0
]
==
'-'
;
av
++
)
{
if
(
!
strcmp
(
av
[
0
],
"-a"
))
{
all
=
1
;
debug
=
0
;
}
else
if
(
!
strcmp
(
av
[
0
],
"-d"
))
{
all
=
0
;
debug
=
1
;
}
else
{
VCLI_Out
(
cli
,
"Unknown flag
\n
"
);
VCLI_SetResult
(
cli
,
CLIS_UNKNOWN
);
return
;
}
}
if
(
av
[
0
]
!=
NULL
)
{
VTAILQ_FOREACH
(
clp
,
&
cs
->
funcs
,
list
)
{
if
(
clp
->
auth
<=
cli
->
auth
&&
!
strcmp
(
clp
->
desc
->
request
,
av
[
2
]))
{
!
strcmp
(
clp
->
desc
->
request
,
av
[
0
]))
{
VCLI_Out
(
cli
,
"%s
\n
%s
\n
"
,
clp
->
desc
->
syntax
,
clp
->
desc
->
help
);
return
;
...
...
@@ -151,13 +156,13 @@ VCLS_func_help(struct cli *cli, const char * const *av, void *priv)
VTAILQ_FOREACH
(
clp
,
&
cs
->
funcs
,
list
)
{
if
(
clp
->
auth
>
cli
->
auth
)
continue
;
d
=
strchr
(
clp
->
flags
,
'd'
)
!=
NULL
?
1
:
0
;
d
=
strchr
(
clp
->
flags
,
'd'
)
!=
NULL
?
1
:
0
;
if
(
d
&&
(
!
all
&&
!
debug
))
continue
;
if
(
debug
&&
!
d
)
continue
;
if
(
clp
->
desc
->
syntax
!=
NULL
)
VCLI_Out
(
cli
,
"%s
\n
"
,
clp
->
desc
->
syntax
);
AN
(
clp
->
desc
->
syntax
);
VCLI_Out
(
cli
,
"%s
\n
"
,
clp
->
desc
->
syntax
);
}
}
...
...
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