Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
95e107db
Commit
95e107db
authored
Apr 28, 2005
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the size-parsing code for --max-size into its own function.
parent
513fd04d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
21 deletions
+30
-21
options.c
options.c
+30
-21
No files found.
options.c
View file @
95e107db
...
...
@@ -622,6 +622,35 @@ static int count_args(const char **argv)
}
static
OFF_T
parse_size_arg
(
const
char
*
size_arg
)
{
const
char
*
arg
;
OFF_T
size
;
for
(
arg
=
size_arg
;
isdigit
(
*
(
uchar
*
)
arg
);
arg
++
)
{}
if
(
*
arg
==
'.'
)
for
(
arg
++
;
isdigit
(
*
(
uchar
*
)
arg
);
arg
++
)
{}
switch
(
*
arg
)
{
case
'k'
:
case
'K'
:
size
=
atof
(
size_arg
)
*
1024
;
break
;
case
'm'
:
case
'M'
:
size
=
atof
(
size_arg
)
*
1024
*
1024
;
break
;
case
'g'
:
case
'G'
:
size
=
atof
(
size_arg
)
*
1024
*
1024
*
1024
;
break
;
case
'\0'
:
size
=
atof
(
size_arg
);
break
;
default:
size
=
0
;
break
;
}
return
size
;
}
static
void
create_refuse_error
(
int
which
)
{
/* The "which" value is the index + OPT_REFUSED_BASE. */
...
...
@@ -807,27 +836,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
break
;
case
OPT_MAX_SIZE
:
for
(
arg
=
max_size_arg
;
isdigit
(
*
(
uchar
*
)
arg
);
arg
++
)
{}
if
(
*
arg
==
'.'
)
for
(
arg
++
;
isdigit
(
*
(
uchar
*
)
arg
);
arg
++
)
{}
switch
(
*
arg
)
{
case
'k'
:
case
'K'
:
max_size
=
atof
(
max_size_arg
)
*
1024
;
break
;
case
'm'
:
case
'M'
:
max_size
=
atof
(
max_size_arg
)
*
1024
*
1024
;
break
;
case
'g'
:
case
'G'
:
max_size
=
atof
(
max_size_arg
)
*
1024
*
1024
*
1024
;
break
;
case
'\0'
:
max_size
=
atof
(
max_size_arg
);
break
;
default:
max_size
=
0
;
break
;
}
if
(
max_size
<=
0
)
{
if
((
max_size
=
parse_size_arg
(
max_size_arg
))
<=
0
)
{
snprintf
(
err_buf
,
sizeof
err_buf
,
"--max-size value is invalid: %s
\n
"
,
max_size_arg
);
...
...
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