Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
Container 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
Main
Synchronet
Commits
e32a3ea3
Commit
e32a3ea3
authored
18 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added a POSIX-compliant strtok_r() implementation for non-*nix platforms.
parent
bcc386c6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/genwrap.c
+40
-1
40 additions, 1 deletion
src/xpdev/genwrap.c
src/xpdev/genwrap.h
+2
-0
2 additions, 0 deletions
src/xpdev/genwrap.h
with
42 additions
and
1 deletion
src/xpdev/genwrap.c
+
40
−
1
View file @
e32a3ea3
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
5
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
6
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -231,6 +231,45 @@ char* strrev(char* str)
}
#endif
#if !defined(__unix__)
/****************************************************************************/
/* Implementations of the recursive (thread-safe) version of strtok */
/* Thanks to Apache Portable Runtime (APR) */
/****************************************************************************/
char
*
DLLCALL
strtok_r
(
char
*
str
,
const
char
*
delim
,
char
**
last
)
{
char
*
token
;
if
(
str
==
NULL
)
/* subsequent call */
str
=
*
last
;
/* start where we left off */
/* skip characters in delimiter (will terminate at '\0') */
while
(
*
str
&&
strchr
(
delim
,
*
str
))
++
str
;
if
(
!*
str
)
/* no more tokens */
return
NULL
;
token
=
str
;
/* skip valid token characters to terminate token and
* prepare for the next call (will terminate at '\0)
*/
*
last
=
token
+
1
;
while
(
**
last
&&
!
strchr
(
delim
,
**
last
))
++*
last
;
if
(
**
last
)
{
**
last
=
'\0'
;
++*
last
;
}
return
token
;
}
#endif
/****************************************************************************/
/* Initialize (seed) the random number generator */
/****************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/genwrap.h
+
2
−
0
View file @
e32a3ea3
...
...
@@ -290,6 +290,8 @@ DLLEXPORT int DLLCALL get_errno(void);
DLLEXPORT
struct
tm
*
DLLCALL
localtime_r
(
const
time_t
*
t
,
struct
tm
*
tm
);
DLLEXPORT
char
*
DLLCALL
ctime_r
(
const
time_t
*
t
,
char
*
buf
);
DLLEXPORT
char
*
DLLCALL
asctime_r
(
const
struct
tm
*
tm
,
char
*
buf
);
DLLEXPORT
char
*
DLLCALL
strtok_r
(
char
*
str
,
const
char
*
delim
,
char
**
last
);
#endif
#if defined(__solaris__)
...
...
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