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
aa2cb7fe
Commit
aa2cb7fe
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created global function: file_getext(), returns extension portion of given
path/filename (or undefined if none found).
parent
1aeb725e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/js_global.c
+27
-0
27 additions, 0 deletions
src/sbbs3/js_global.c
with
27 additions
and
0 deletions
src/sbbs3/js_global.c
+
27
−
0
View file @
aa2cb7fe
...
@@ -1096,6 +1096,29 @@ js_getfname(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
...
@@ -1096,6 +1096,29 @@ js_getfname(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return
(
JS_TRUE
);
return
(
JS_TRUE
);
}
}
static
JSBool
js_getfext
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
*
str
;
char
*
p
;
JSString
*
js_str
;
if
((
str
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
0
])))
==
NULL
)
return
(
JS_FALSE
);
*
rval
=
JSVAL_VOID
;
if
((
p
=
getfext
(
str
))
==
NULL
)
return
(
JS_TRUE
);
js_str
=
JS_NewStringCopyZ
(
cx
,
p
);
if
(
js_str
==
NULL
)
return
(
JS_FALSE
);
*
rval
=
STRING_TO_JSVAL
(
js_str
);
return
(
JS_TRUE
);
}
static
JSBool
static
JSBool
js_getfcase
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
js_getfcase
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
{
...
@@ -1534,6 +1557,10 @@ static jsMethodSpec js_global_functions[] = {
...
@@ -1534,6 +1557,10 @@ static jsMethodSpec js_global_functions[] = {
{
"file_getname"
,
js_getfname
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string path"
)
{
"file_getname"
,
js_getfname
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string path"
)
,
JSDOCSTR
(
"returns filename portion of passed path string"
)
,
JSDOCSTR
(
"returns filename portion of passed path string"
)
},
},
{
"file_getext"
,
js_getfext
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string path"
)
,
JSDOCSTR
(
"returns file extension portion of passed path/filename string (including '.') "
"or <i>undefined</i> if no extension is found"
)
},
{
"file_getcase"
,
js_getfcase
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string filename"
)
{
"file_getcase"
,
js_getfcase
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string filename"
)
,
JSDOCSTR
(
"returns correct case of filename (long version of filename on Win32) "
,
JSDOCSTR
(
"returns correct case of filename (long version of filename on Win32) "
"or <i>undefined</i> if the file doesn't exist"
)
"or <i>undefined</i> if the file doesn't exist"
)
...
...
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