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
a8543cf0
Commit
a8543cf0
authored
5 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
pass to new integrer type for type variable
parent
91e47087
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/lib66/backup_cmd_switcher.c
+22
-20
22 additions, 20 deletions
src/lib66/backup_cmd_switcher.c
with
22 additions
and
20 deletions
src/lib66/backup_cmd_switcher.c
+
22
−
20
View file @
a8543cf0
...
@@ -42,13 +42,14 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
...
@@ -42,13 +42,14 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
uint32_t
what
=
-
1
;
uint32_t
what
=
-
1
;
int
r
;
int
r
;
struct
stat
st
;
struct
stat
st
;
char
const
*
tree
=
NULL
;
char
const
*
tree
=
NULL
;
verbosity
=
1
;
change
=
back
=
type
=
0
;
verbosity
=
1
;
change
=
back
=
0
;
type
=
-
1
;
{
{
subgetopt_t
l
=
SUBGETOPT_ZERO
;
subgetopt_t
l
=
SUBGETOPT_ZERO
;
...
@@ -70,11 +71,11 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
...
@@ -70,11 +71,11 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
}
}
if
(
argc
<
1
)
return
-
1
;
if
(
argc
<
1
)
return
-
1
;
if
((
!
change
&&
!
back
)
||
!
type
)
return
-
1
;
if
((
!
change
&&
!
back
)
||
type
<
0
)
return
-
1
;
if
(
type
<
TYPE_CLASSIC
||
type
>
TYPE_ONESHOT
)
if
(
type
<
TYPE_CLASSIC
||
type
>
TYPE_ONESHOT
)
log_warn_return
(
LOG_EXIT_LESSONE
,
"unknown type for backup_switcher"
)
;
log_warn_return
(
LOG_EXIT_LESSONE
,
"unknown type for backup_switcher"
)
;
tree
=
*
argv
;
tree
=
*
argv
;
size_t
treelen
=
strlen
(
tree
)
;
size_t
treelen
=
strlen
(
tree
)
;
...
@@ -106,20 +107,21 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
...
@@ -106,20 +107,21 @@ int backup_switcher(int argc, char const *const *argv,ssexec_t *info)
{
{
if
(
lstat
(
sym
,
&
st
)
<
0
)
return
-
1
;
if
(
lstat
(
sym
,
&
st
)
<
0
)
return
-
1
;
if
(
!
(
S_ISLNK
(
st
.
st_mode
)))
if
(
!
(
S_ISLNK
(
st
.
st_mode
)))
log_warn_return
(
LOG_EXIT_LESSONE
,
"find symlink: "
,
sym
)
;
log_warn
usys
_return
(
LOG_EXIT_LESSONE
,
"find symlink: "
,
sym
)
;
stralloc
symreal
=
STRALLOC_ZERO
;
stralloc
symreal
=
STRALLOC_ZERO
;
r
=
sarealpath
(
&
symreal
,
sym
)
;
r
=
sarealpath
(
&
symreal
,
sym
)
;
if
(
r
<
0
)
if
(
r
<
0
)
log_warnusys_return
(
LOG_EXIT_LESSONE
,
"retrieve real path from: "
,
sym
)
;
log_warnusys_return
(
LOG_EXIT_LESSONE
,
"retrieve real path from: "
,
sym
)
;
char
*
b
=
NULL
;
char
*
b
=
NULL
;
b
=
memmem
(
symreal
.
s
,
symreal
.
len
,
SS_BACKUP
,
SS_BACKUP_LEN
)
;
b
=
memmem
(
symreal
.
s
,
symreal
.
len
,
SS_BACKUP
,
SS_BACKUP_LEN
)
;
stralloc_free
(
&
symreal
)
;
stralloc_free
(
&
symreal
)
;
if
(
!
b
)
return
SS_SWSRC
;
if
(
!
b
)
return
SS_SWSRC
;
return
SS_SWBACK
;
return
SS_SWBACK
;
}
}
...
@@ -186,29 +188,29 @@ int backup_cmd_switcher(unsigned int verbosity,char const *cmd,ssexec_t *info)
...
@@ -186,29 +188,29 @@ int backup_cmd_switcher(unsigned int verbosity,char const *cmd,ssexec_t *info)
int
r
;
int
r
;
size_t
pos
=
0
;
size_t
pos
=
0
;
stralloc
opts
=
STRALLOC_ZERO
;
stralloc
opts
=
STRALLOC_ZERO
;
if
(
!
sastr_clean_string
(
&
opts
,
cmd
))
if
(
!
sastr_clean_string
(
&
opts
,
cmd
))
log_warnu_return
(
LOG_EXIT_LESSONE
,
"clean: "
,
cmd
)
;
log_warnu_return
(
LOG_EXIT_LESSONE
,
"clean: "
,
cmd
)
;
int
newopts
=
5
+
sastr_len
(
&
opts
)
;
int
newopts
=
5
+
sastr_len
(
&
opts
)
;
char
const
*
newargv
[
newopts
]
;
char
const
*
newargv
[
newopts
]
;
unsigned
int
m
=
0
;
unsigned
int
m
=
0
;
char
fmt
[
UINT_FMT
]
;
char
fmt
[
UINT_FMT
]
;
fmt
[
uint_fmt
(
fmt
,
verbosity
)]
=
0
;
fmt
[
uint_fmt
(
fmt
,
verbosity
)]
=
0
;
newargv
[
m
++
]
=
"backup_switcher"
;
newargv
[
m
++
]
=
"backup_switcher"
;
newargv
[
m
++
]
=
"-v"
;
newargv
[
m
++
]
=
"-v"
;
newargv
[
m
++
]
=
fmt
;
newargv
[
m
++
]
=
fmt
;
for
(;
pos
<
opts
.
len
;
pos
+=
strlen
(
opts
.
s
+
pos
)
+
1
)
for
(;
pos
<
opts
.
len
;
pos
+=
strlen
(
opts
.
s
+
pos
)
+
1
)
newargv
[
m
++
]
=
opts
.
s
+
pos
;
newargv
[
m
++
]
=
opts
.
s
+
pos
;
newargv
[
m
++
]
=
info
->
treename
.
s
;
newargv
[
m
++
]
=
info
->
treename
.
s
;
newargv
[
m
++
]
=
0
;
newargv
[
m
++
]
=
0
;
r
=
backup_switcher
(
newopts
,
newargv
,
info
)
;
r
=
backup_switcher
(
newopts
,
newargv
,
info
)
;
stralloc_free
(
&
opts
)
;
stralloc_free
(
&
opts
)
;
return
r
;
return
r
;
}
}
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