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
79da9cf8
Commit
79da9cf8
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added Watcom C/C++ support.
parent
1a6f33d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/dirwrap.c
+69
-8
69 additions, 8 deletions
src/xpdev/dirwrap.c
src/xpdev/dirwrap.h
+2
-0
2 additions, 0 deletions
src/xpdev/dirwrap.h
with
71 additions
and
8 deletions
src/xpdev/dirwrap.c
+
69
−
8
View file @
79da9cf8
...
...
@@ -62,6 +62,10 @@
#endif
/* __unix__ */
#if defined(__WATCOMC__)
#include
<dos.h>
#endif
#include
<sys/types.h>
/* _dev_t */
#include
<sys/stat.h>
/* struct stat */
...
...
@@ -136,6 +140,65 @@ static int glob_compare( const void *arg1, const void *arg2 )
#pragma argsused
#endif
#if defined(__WATCOMC__)
int
DLLCALL
glob
(
const
char
*
pattern
,
int
flags
,
void
*
unused
,
glob_t
*
glob
)
{
struct
find_t
ff
;
size_t
found
=
0
;
char
path
[
MAX_PATH
+
1
];
char
*
p
;
char
**
new_pathv
;
if
(
!
(
flags
&
GLOB_APPEND
))
{
glob
->
gl_pathc
=
0
;
glob
->
gl_pathv
=
NULL
;
}
if
(
_dos_findfirst
((
char
*
)
pattern
,
_A_NORMAL
,
&
ff
)
!=
0
)
return
(
GLOB_NOMATCH
);
do
{
if
(
!
(
flags
&
GLOB_ONLYDIR
)
||
ff
.
attrib
&
_A_SUBDIR
)
{
if
((
new_pathv
=
realloc
(
glob
->
gl_pathv
,(
glob
->
gl_pathc
+
1
)
*
sizeof
(
char
*
)))
==
NULL
)
{
globfree
(
glob
);
return
(
GLOB_NOSPACE
);
}
glob
->
gl_pathv
=
new_pathv
;
/* build the full pathname */
SAFECOPY
(
path
,
pattern
);
p
=
getfname
(
path
);
*
p
=
0
;
strcat
(
path
,
ff
.
name
);
if
((
glob
->
gl_pathv
[
glob
->
gl_pathc
]
=
malloc
(
strlen
(
path
)
+
2
))
==
NULL
)
{
globfree
(
glob
);
return
(
GLOB_NOSPACE
);
}
strcpy
(
glob
->
gl_pathv
[
glob
->
gl_pathc
],
path
);
if
(
flags
&
GLOB_MARK
&&
ff
.
attrib
&
_A_SUBDIR
)
strcat
(
glob
->
gl_pathv
[
glob
->
gl_pathc
],
"/"
);
glob
->
gl_pathc
++
;
found
++
;
}
}
while
(
_dos_findnext
(
&
ff
)
==
0
);
_dos_findclose
(
&
ff
);
if
(
found
==
0
)
return
(
GLOB_NOMATCH
);
if
(
!
(
flags
&
GLOB_NOSORT
))
{
qsort
(
glob
->
gl_pathv
,
found
,
sizeof
(
char
*
),
glob_compare
);
}
return
(
0
);
/* success */
}
#else
int
DLLCALL
glob
(
const
char
*
pattern
,
int
flags
,
void
*
unused
,
glob_t
*
glob
)
{
struct
_finddata_t
ff
;
...
...
@@ -193,6 +256,8 @@ int DLLCALL glob(const char *pattern, int flags, void* unused, glob_t* glob)
return
(
0
);
/* success */
}
#endif
void
DLLCALL
globfree
(
glob_t
*
glob
)
{
size_t
i
;
...
...
@@ -344,7 +409,9 @@ BOOL DLLCALL fexist(const char *filespec)
return
(
TRUE
);
#elif defined(__unix__)
/* portion by cmartin */
#else
/* Unix or OS/2 */
/* portion by cmartin */
glob_t
g
;
int
c
;
...
...
@@ -373,12 +440,6 @@ BOOL DLLCALL fexist(const char *filespec)
globfree
(
&
g
);
return
FALSE
;
#else
#warning "fexist() port needs to support wildcards!"
return
(
FALSE
);
#endif
}
...
...
@@ -555,7 +616,7 @@ ulong DLLCALL getfreediskspace(const char* path)
#else
#warning OS-specific code needed here
fprintf
(
stderr
,
"
\n
*** !Missing getfreediskspace implementation ***
\n
"
);
return
(
0
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/dirwrap.h
+
2
−
0
View file @
79da9cf8
...
...
@@ -137,6 +137,8 @@ extern "C" {
struct
dirent
*
readdir
(
DIR
*
__dir
);
int
closedir
(
DIR
*
__dir
);
void
rewinddir
(
DIR
*
__dir
);
#elif defined(__WATCOMC__)
#include
<direct.h>
/* opendir, etc defined here in Watcom */
#else
#include
<dirent.h>
/* POSIX directory functions */
#endif
...
...
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