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
9074f7ec
Commit
9074f7ec
authored
5 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
add optional depends field
parent
1ab12af1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/66/66-inservice.c
+39
-8
39 additions, 8 deletions
src/66/66-inservice.c
with
39 additions
and
8 deletions
src/66/66-inservice.c
+
39
−
8
View file @
9074f7ec
...
...
@@ -63,6 +63,7 @@ static void info_display_description(char const *field, ss_resolve_t *res) ;
static
void
info_display_source
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_live
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_deps
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_optsdeps
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_start
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_stop
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
static
void
info_display_envat
(
char
const
*
field
,
ss_resolve_t
*
res
)
;
...
...
@@ -83,17 +84,18 @@ info_opts_map_t const opts_sv_table[] =
{
.
str
=
"source"
,
.
svfunc
=
&
info_display_source
,
.
id
=
5
},
{
.
str
=
"live"
,
.
svfunc
=
&
info_display_live
,
.
id
=
6
},
{
.
str
=
"depends"
,
.
svfunc
=
&
info_display_deps
,
.
id
=
7
},
{
.
str
=
"start"
,
.
svfunc
=
&
info_display_start
,
.
id
=
8
},
{
.
str
=
"stop"
,
.
svfunc
=
&
info_display_stop
,
.
id
=
9
},
{
.
str
=
"envat"
,
.
svfunc
=
&
info_display_envat
,
.
id
=
10
},
{
.
str
=
"envfile"
,
.
svfunc
=
&
info_display_envfile
,
.
id
=
11
},
{
.
str
=
"logname"
,
.
svfunc
=
&
info_display_logname
,
.
id
=
12
},
{
.
str
=
"logdst"
,
.
svfunc
=
&
info_display_logdst
,
.
id
=
13
},
{
.
str
=
"logfile"
,
.
svfunc
=
&
info_display_logfile
,
.
id
=
14
},
{
.
str
=
"optsdepends"
,
.
svfunc
=
&
info_display_optsdeps
,
.
id
=
8
},
{
.
str
=
"start"
,
.
svfunc
=
&
info_display_start
,
.
id
=
9
},
{
.
str
=
"stop"
,
.
svfunc
=
&
info_display_stop
,
.
id
=
10
},
{
.
str
=
"envat"
,
.
svfunc
=
&
info_display_envat
,
.
id
=
11
},
{
.
str
=
"envfile"
,
.
svfunc
=
&
info_display_envfile
,
.
id
=
12
},
{
.
str
=
"logname"
,
.
svfunc
=
&
info_display_logname
,
.
id
=
13
},
{
.
str
=
"logdst"
,
.
svfunc
=
&
info_display_logdst
,
.
id
=
14
},
{
.
str
=
"logfile"
,
.
svfunc
=
&
info_display_logfile
,
.
id
=
15
},
{
.
str
=
0
,
.
svfunc
=
0
,
.
id
=
-
1
}
}
;
#define MAXOPTS 1
6
#define MAXOPTS 1
7
#define checkopts(n) if (n >= MAXOPTS) strerr_dief1x(100, "too many options")
#define DELIM ','
...
...
@@ -125,6 +127,7 @@ static inline void info_help (void)
" source: displays the source of the service's frontend file
\n
"
" live: displays the service's live directory
\n
"
" depends: displays the service's dependencies
\n
"
" optsdepends: displays the service's optional dependencies
\n
"
" start: displays the service's start script
\n
"
" stop: displays the service's stop script
\n
"
" envat: displays the source of the environment file
\n
"
...
...
@@ -318,6 +321,33 @@ static void info_display_deps(char const *field, ss_resolve_t *res)
stralloc_free
(
&
salist
)
;
}
static
void
info_display_optsdeps
(
char
const
*
field
,
ss_resolve_t
*
res
)
{
stralloc
salist
=
STRALLOC_ZERO
;
info_display_field_name
(
field
)
;
if
(
!
res
->
noptsdeps
)
goto
empty
;
if
(
!
bprintf
(
buffer_1
,
"%s"
,
" "
))
log_dieusys
(
LOG_EXIT_SYS
,
"write to stdout"
)
;
if
(
!
sastr_clean_string
(
&
salist
,
res
->
sa
.
s
+
res
->
optsdeps
))
log_dieu
(
LOG_EXIT_SYS
,
"build dependencies list"
)
;
if
(
REVERSE
)
if
(
!
sastr_reverse
(
&
salist
))
log_dieu
(
LOG_EXIT_SYS
,
"reverse dependencies list"
)
;
info_display_list
(
field
,
&
salist
)
;
goto
freed
;
empty:
if
(
!
bprintf
(
buffer_1
,
"%s%s%s
\n
"
,
log_color
->
warning
,
" no optional dependencies"
,
log_color
->
off
))
log_dieusys
(
LOG_EXIT_SYS
,
"write to stdout"
)
;
freed:
stralloc_free
(
&
salist
)
;
}
static
void
info_display_start
(
char
const
*
field
,
ss_resolve_t
*
res
)
{
info_display_field_name
(
field
)
;
...
...
@@ -549,6 +579,7 @@ int main(int argc, char const *const *argv, char const *const *envp)
"Source"
,
"Live"
,
"Depends on"
,
"Optional depends"
,
"Start script"
,
"Stop script"
,
"Environment source"
,
...
...
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