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
2e1ea68d
Commit
2e1ea68d
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created new global method: getfilename (wrapper for internal getfname func)
- returns filename portion of path string.
parent
6f04bdc2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/js_global.c
+20
-1
20 additions, 1 deletion
src/sbbs3/js_global.c
with
20 additions
and
1 deletion
src/sbbs3/js_global.c
+
20
−
1
View file @
2e1ea68d
...
...
@@ -1034,6 +1034,22 @@ js_truncstr(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return
(
JS_TRUE
);
}
static
JSBool
js_getfname
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
*
str
;
JSString
*
js_str
;
if
((
str
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
0
])))
==
NULL
)
return
(
JS_FALSE
);
js_str
=
JS_NewStringCopyZ
(
cx
,
getfname
(
str
));
if
(
js_str
==
NULL
)
return
(
JS_FALSE
);
*
rval
=
STRING_TO_JSVAL
(
js_str
);
return
(
JS_TRUE
);
}
static
JSBool
js_fexist
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
...
...
@@ -1297,9 +1313,12 @@ static jsMethodSpec js_global_functions[] = {
{
"truncstr"
,
js_truncstr
,
2
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text, charset"
)
,
JSDOCSTR
(
"truncate string at first char in <i>charset</i>"
)
},
{
"lfexpand"
,
js_lfexpand
,
2
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text"
)
{
"lfexpand"
,
js_lfexpand
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"expand line-feeds (LF) to carriage-return/line-feeds (CRLF)"
)
},
{
"getfilename"
,
js_getfname
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"returns filename portion of passed path string"
)
},
{
"file_exists"
,
js_fexist
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename"
)
,
JSDOCSTR
(
"verify file existence"
)
},
...
...
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