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
a8facdc0
Commit
a8facdc0
authored
Nov 09, 2006
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a new isSpace() inline function to call isspace() safely
when using a signed character pointer.
parent
c5e29261
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
poptconfig.c
popt/poptconfig.c
+7
-7
popthelp.c
popt/popthelp.c
+3
-3
poptint.h
popt/poptint.h
+6
-0
poptparse.c
popt/poptparse.c
+9
-7
No files found.
popt/poptconfig.c
View file @
a8facdc0
...
@@ -30,20 +30,20 @@ static void configLine(poptContext con, char * line)
...
@@ -30,20 +30,20 @@ static void configLine(poptContext con, char * line)
if
(
strncmp
(
line
,
con
->
appName
,
nameLength
))
return
;
if
(
strncmp
(
line
,
con
->
appName
,
nameLength
))
return
;
line
+=
nameLength
;
line
+=
nameLength
;
if
(
*
line
==
'\0'
||
!
is
space
(
*
line
))
return
;
if
(
*
line
==
'\0'
||
!
is
Space
(
line
))
return
;
while
(
*
line
!=
'\0'
&&
is
space
(
*
line
))
line
++
;
while
(
*
line
!=
'\0'
&&
is
Space
(
line
))
line
++
;
entryType
=
line
;
entryType
=
line
;
while
(
*
line
==
'\0'
||
!
is
space
(
*
line
))
line
++
;
while
(
*
line
==
'\0'
||
!
is
Space
(
line
))
line
++
;
*
line
++
=
'\0'
;
*
line
++
=
'\0'
;
while
(
*
line
!=
'\0'
&&
is
space
(
*
line
))
line
++
;
while
(
*
line
!=
'\0'
&&
is
Space
(
line
))
line
++
;
if
(
*
line
==
'\0'
)
return
;
if
(
*
line
==
'\0'
)
return
;
opt
=
line
;
opt
=
line
;
while
(
*
line
==
'\0'
||
!
is
space
(
*
line
))
line
++
;
while
(
*
line
==
'\0'
||
!
is
Space
(
line
))
line
++
;
*
line
++
=
'\0'
;
*
line
++
=
'\0'
;
while
(
*
line
!=
'\0'
&&
is
space
(
*
line
))
line
++
;
while
(
*
line
!=
'\0'
&&
is
Space
(
line
))
line
++
;
if
(
*
line
==
'\0'
)
return
;
if
(
*
line
==
'\0'
)
return
;
/*@-temptrans@*/
/* FIX: line alias is saved */
/*@-temptrans@*/
/* FIX: line alias is saved */
...
@@ -134,7 +134,7 @@ int poptReadConfigFile(poptContext con, const char * fn)
...
@@ -134,7 +134,7 @@ int poptReadConfigFile(poptContext con, const char * fn)
case
'\n'
:
case
'\n'
:
*
dst
=
'\0'
;
*
dst
=
'\0'
;
dst
=
buf
;
dst
=
buf
;
while
(
*
dst
&&
is
space
(
*
dst
))
dst
++
;
while
(
*
dst
&&
is
Space
(
dst
))
dst
++
;
if
(
*
dst
&&
*
dst
!=
'#'
)
if
(
*
dst
&&
*
dst
!=
'#'
)
configLine
(
con
,
dst
);
configLine
(
con
,
dst
);
chptr
++
;
chptr
++
;
...
...
popt/popthelp.c
View file @
a8facdc0
...
@@ -381,9 +381,9 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
...
@@ -381,9 +381,9 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
char
format
[
16
];
char
format
[
16
];
ch
=
help
+
lineLength
-
1
;
ch
=
help
+
lineLength
-
1
;
while
(
ch
>
help
&&
!
is
space
(
*
ch
))
ch
--
;
while
(
ch
>
help
&&
!
is
Space
(
ch
))
ch
--
;
if
(
ch
==
help
)
break
;
/* give up */
if
(
ch
==
help
)
break
;
/* give up */
while
(
ch
>
(
help
+
1
)
&&
is
space
(
*
ch
))
ch
--
;
while
(
ch
>
(
help
+
1
)
&&
is
Space
(
ch
))
ch
--
;
ch
++
;
ch
++
;
snprintf
(
format
,
sizeof
format
,
"%%.%ds
\n
%%%ds"
,
(
int
)
(
ch
-
help
),
(
int
)
indentLength
);
snprintf
(
format
,
sizeof
format
,
"%%.%ds
\n
%%%ds"
,
(
int
)
(
ch
-
help
),
(
int
)
indentLength
);
...
@@ -391,7 +391,7 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
...
@@ -391,7 +391,7 @@ static void singleOptionHelp(FILE * fp, size_t maxLeftCol,
fprintf
(
fp
,
format
,
help
,
" "
);
fprintf
(
fp
,
format
,
help
,
" "
);
/*@=formatconst@*/
/*@=formatconst@*/
help
=
ch
;
help
=
ch
;
while
(
is
space
(
*
help
)
&&
*
help
)
help
++
;
while
(
is
Space
(
help
)
&&
*
help
)
help
++
;
helpLength
=
strlen
(
help
);
helpLength
=
strlen
(
help
);
}
}
/*@=boundsread@*/
/*@=boundsread@*/
...
...
popt/poptint.h
View file @
a8facdc0
...
@@ -22,6 +22,12 @@ _free(/*@only@*/ /*@null@*/ const void * p)
...
@@ -22,6 +22,12 @@ _free(/*@only@*/ /*@null@*/ const void * p)
return
NULL
;
return
NULL
;
}
}
static
inline
int
isSpace
(
const
char
*
ptr
)
{
return
isspace
(
*
(
unsigned
char
*
)
ptr
);
}
/* Bit mask macros. */
/* Bit mask macros. */
/*@-exporttype -redef @*/
/*@-exporttype -redef @*/
typedef
unsigned
int
__pbm_bits
;
typedef
unsigned
int
__pbm_bits
;
...
...
popt/poptparse.c
View file @
a8facdc0
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include "system.h"
#include "system.h"
#include "poptint.h"
#define POPT_ARGV_ARRAY_GROW_DELTA 5
#define POPT_ARGV_ARRAY_GROW_DELTA 5
/*@-boundswrite@*/
/*@-boundswrite@*/
...
@@ -81,7 +83,7 @@ int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
...
@@ -81,7 +83,7 @@ int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
if
(
*
src
!=
quote
)
*
buf
++
=
'\\'
;
if
(
*
src
!=
quote
)
*
buf
++
=
'\\'
;
}
}
*
buf
++
=
*
src
;
*
buf
++
=
*
src
;
}
else
if
(
is
space
(
*
src
))
{
}
else
if
(
is
Space
(
src
))
{
if
(
*
argv
[
argc
]
!=
'\0'
)
{
if
(
*
argv
[
argc
]
!=
'\0'
)
{
buf
++
,
argc
++
;
buf
++
,
argc
++
;
if
(
argc
==
argvAlloced
)
{
if
(
argc
==
argvAlloced
)
{
...
@@ -157,7 +159,7 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
...
@@ -157,7 +159,7 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
p
=
line
;
p
=
line
;
/* loop until first non-space char or EOL */
/* loop until first non-space char or EOL */
while
(
*
p
!=
'\0'
&&
is
space
(
*
p
)
)
while
(
*
p
!=
'\0'
&&
is
Space
(
p
)
)
p
++
;
p
++
;
linelen
=
strlen
(
p
);
linelen
=
strlen
(
p
);
...
@@ -169,13 +171,13 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
...
@@ -169,13 +171,13 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
q
=
p
;
q
=
p
;
while
(
*
q
!=
'\0'
&&
(
!
is
space
(
*
q
))
&&
*
q
!=
'='
)
while
(
*
q
!=
'\0'
&&
(
!
is
Space
(
q
))
&&
*
q
!=
'='
)
q
++
;
q
++
;
if
(
is
space
(
*
q
))
{
if
(
is
Space
(
q
))
{
/* a space after the name, find next non space */
/* a space after the name, find next non space */
*
q
++=
'\0'
;
*
q
++=
'\0'
;
while
(
*
q
!=
'\0'
&&
is
space
((
int
)
*
q
)
)
q
++
;
while
(
*
q
!=
'\0'
&&
is
Space
(
q
)
)
q
++
;
}
}
if
(
*
q
==
'\0'
)
{
if
(
*
q
==
'\0'
)
{
/* single command line option (ie, no name=val, just name) */
/* single command line option (ie, no name=val, just name) */
...
@@ -197,14 +199,14 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
...
@@ -197,14 +199,14 @@ int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
*
q
++
=
'\0'
;
*
q
++
=
'\0'
;
/* find next non-space letter of value */
/* find next non-space letter of value */
while
(
*
q
!=
'\0'
&&
is
space
(
*
q
))
while
(
*
q
!=
'\0'
&&
is
Space
(
q
))
q
++
;
q
++
;
if
(
*
q
==
'\0'
)
if
(
*
q
==
'\0'
)
continue
;
/* XXX silently ignore missing value */
continue
;
/* XXX silently ignore missing value */
/* now, loop and strip all ending whitespace */
/* now, loop and strip all ending whitespace */
x
=
p
+
linelen
;
x
=
p
+
linelen
;
while
(
is
space
(
*
--
x
))
while
(
is
Space
(
--
x
))
*
x
=
0
;
/* null out last char if space (including fgets() NL) */
*
x
=
0
;
/* null out last char if space (including fgets() NL) */
/* rest of line accept */
/* rest of line accept */
...
...
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