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
b3eac84d
Commit
b3eac84d
authored
5 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Change getfilecount() to allow the pattern to be specified (or not) in the path
argument, eliminate the spec/pattern argument.
parent
93f4f04b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sbbs3/atcodes.cpp
+1
-1
1 addition, 1 deletion
src/sbbs3/atcodes.cpp
src/xpdev/dirwrap.c
+6
-4
6 additions, 4 deletions
src/xpdev/dirwrap.c
src/xpdev/dirwrap.h
+1
-1
1 addition, 1 deletion
src/xpdev/dirwrap.h
with
8 additions
and
6 deletions
src/sbbs3/atcodes.cpp
+
1
−
1
View file @
b3eac84d
...
...
@@ -449,7 +449,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode)
if
(
strncmp
(
sp
,
"FILES:"
,
6
)
==
0
)
{
// Number of files in specified directory
const
char
*
path
=
getpath
(
&
cfg
,
sp
+
6
);
safe_snprintf
(
str
,
maxlen
,
"%lu"
,
getfilecount
(
path
,
ALLFILES
));
safe_snprintf
(
str
,
maxlen
,
"%lu"
,
getfilecount
(
path
));
return
str
;
}
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/dirwrap.c
+
6
−
4
View file @
b3eac84d
...
...
@@ -792,10 +792,10 @@ long DLLCALL delfiles(const char *inpath, const char *spec, size_t keep)
}
/****************************************************************************/
/* Returns number of files
in a directory (inpath)
matching 'pat
tern'
*/
/* Returns number of files matching '
in
pat
h'
*/
/* Similar, but not identical, to getdirsize(), e.g. subdirs never counted */
/****************************************************************************/
ulong
DLLCALL
getfilecount
(
const
char
*
inpath
,
const
char
*
pattern
)
ulong
DLLCALL
getfilecount
(
const
char
*
inpath
)
{
char
path
[
MAX_PATH
+
1
];
glob_t
g
;
...
...
@@ -803,8 +803,10 @@ ulong DLLCALL getfilecount(const char *inpath, const char* pattern)
ulong
count
=
0
;
SAFECOPY
(
path
,
inpath
);
if
(
isdir
(
path
))
backslash
(
path
);
SAFECAT
(
path
,
pattern
);
if
(
IS_PATH_DELIM
(
*
lastchar
(
path
)))
SAFECAT
(
path
,
ALLFILES
);
if
(
glob
(
path
,
GLOB_MARK
,
NULL
,
&
g
))
return
0
;
for
(
gi
=
0
;
gi
<
g
.
gl_pathc
;
++
gi
)
{
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/dirwrap.h
+
1
−
1
View file @
b3eac84d
...
...
@@ -228,7 +228,7 @@ DLLEXPORT char* DLLCALL getfname(const char* path);
DLLEXPORT
char
*
DLLCALL
getfext
(
const
char
*
path
);
DLLEXPORT
int
DLLCALL
getfattr
(
const
char
*
filename
);
DLLEXPORT
int
DLLCALL
getfmode
(
const
char
*
filename
);
DLLEXPORT
ulong
DLLCALL
getfilecount
(
const
char
*
in
path
,
const
char
*
spec
);
DLLEXPORT
ulong
DLLCALL
getfilecount
(
const
char
*
path
);
DLLEXPORT
char
*
DLLCALL
getdirname
(
const
char
*
path
);
DLLEXPORT
long
DLLCALL
getdirsize
(
const
char
*
path
,
BOOL
include_subdirs
,
BOOL
subdir_only
);
DLLEXPORT
ulong
DLLCALL
getdisksize
(
const
char
*
path
,
ulong
unit
);
...
...
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