Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Vidal
66
Commits
c6ece931
Commit
c6ece931
authored
3 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
add info_graph_display_tree() function
parent
49203b60
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/66/info.h
+3
-3
3 additions, 3 deletions
src/include/66/info.h
src/lib66/info_utils.c
+73
-1
73 additions, 1 deletion
src/lib66/info_utils.c
with
76 additions
and
4 deletions
src/include/66/info.h
+
3
−
3
View file @
c6ece931
...
...
@@ -80,9 +80,9 @@ extern void info_display_list(char const *field, stralloc *list) ;
extern
void
info_display_nline
(
char
const
*
field
,
char
const
*
str
)
;
extern
depth_t
info_graph_init
(
void
)
;
extern
int
info_graph_display_service
(
char
const
*
name
,
char
const
*
obj
)
;
extern
int
info_graph_display
(
char
const
*
name
,
char
const
*
obj
,
info_graph_func
*
func
,
depth_t
*
depth
,
int
last
,
int
padding
,
info_graph_style
*
style
)
;
extern
int
info_walk
(
graph_t
*
g
,
char
const
*
name
,
char
const
*
obj
,
info_graph_func
*
func
,
uint8_t
requiredby
,
uint8_t
reverse
,
depth_t
*
depth
,
int
padding
,
info_graph_style
*
style
)
;
extern
int
info_graph_display
(
char
const
*
name
,
char
const
*
obj
,
info_graph_func
*
func
,
depth_t
*
depth
,
int
last
,
int
padding
,
info_graph_style
*
style
)
;
extern
int
info_graph_display_service
(
char
const
*
name
,
char
const
*
obj
)
;
extern
int
info_graph_display_tree
(
char
const
*
name
,
char
const
*
obj
)
;
#endif
This diff is collapsed.
Click to expand it.
src/lib66/info_utils.c
+
73
−
1
View file @
c6ece931
...
...
@@ -33,6 +33,8 @@
#include
<66/resolve.h>
#include
<66/state.h>
#include
<66/utils.h>
#include
<66/constants.h>
unsigned
int
MAXDEPTH
=
1
;
...
...
@@ -224,13 +226,83 @@ depth_t info_graph_init(void)
return
d
;
}
int
info_graph_display_tree
(
char
const
*
name
,
char
const
*
obj
)
{
log_flow
()
;
int
err
=
0
;
stralloc
sa
=
STRALLOC_ZERO
;
resolve_tree_t
tres
=
RESOLVE_TREE_ZERO
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_TREE
,
&
tres
)
;
uid_t
owner
=
getuid
()
;
if
(
!
set_ownersysdir
(
&
sa
,
owner
))
{
log_warnusys
(
"set owner directory"
)
;
resolve_free
(
wres
)
;
stralloc_free
(
&
sa
)
;
return
err
;
}
char
base
[
sa
.
len
+
1
]
;
auto_strings
(
base
,
sa
.
s
)
;
if
(
tree_isvalid
(
sa
.
s
,
name
)
<=
0
)
{
log_warn
(
"invalide tree: "
,
name
)
;
goto
freed
;
}
if
(
!
auto_stra
(
&
sa
,
SS_SYSTEM
))
goto
freed
;
if
(
!
resolve_check
(
sa
.
s
,
name
))
goto
freed
;
if
(
!
resolve_read
(
wres
,
sa
.
s
,
name
))
goto
freed
;
sa
.
len
=
0
;
int
r
=
set_livedir
(
&
sa
)
;
if
(
r
<=
0
)
goto
freed
;
int
init
=
tree_isinitialized
(
sa
.
s
,
name
,
owner
)
;
int
enabled
=
tree_isenabled
(
base
,
name
)
;
if
(
enabled
<
0
)
goto
freed
;
if
(
!
bprintf
(
buffer_1
,
"(%s%s%s,%s%s%s) %s"
,
\
init
?
log_color
->
valid
:
log_color
->
warning
,
\
init
?
"Initialized"
:
"Unitialized"
,
\
log_color
->
off
,
\
enabled
?
log_color
->
valid
:
log_color
->
error
,
\
enabled
?
"Enabled"
:
"Disabled"
,
\
log_color
->
off
,
\
name
))
goto
freed
;
err
=
1
;
freed:
resolve_free
(
wres
)
;
stralloc_free
(
&
sa
)
;
return
err
;
}
int
info_graph_display_service
(
char
const
*
name
,
char
const
*
obj
)
{
log_flow
()
;
stralloc
tree
=
STRALLOC_ZERO
;
resolve_service_t
res
=
RESOLVE_SERVICE_ZERO
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
SERVICE
_STRUCT
,
&
res
)
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_
SERVICE
,
&
res
)
;
int
r
=
service_intree
(
&
tree
,
name
,
obj
),
err
=
0
;
...
...
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