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
b060c26d
Commit
b060c26d
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created file_rename method.
Renamed crc16, crc32, md5, and chksum methods to crc16_calc, crc32_calc, etc.
parent
c9b642dc
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
+22
-4
22 additions, 4 deletions
src/sbbs3/js_global.c
with
22 additions
and
4 deletions
src/sbbs3/js_global.c
+
22
−
4
View file @
b060c26d
...
@@ -1079,6 +1079,21 @@ js_remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
...
@@ -1079,6 +1079,21 @@ js_remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return
(
JS_TRUE
);
return
(
JS_TRUE
);
}
}
static
JSBool
js_rename
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
*
oldname
;
char
*
newname
;
*
rval
=
BOOLEAN_TO_JSVAL
(
JS_FALSE
);
if
((
oldname
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
0
])))
==
NULL
)
return
(
JS_TRUE
);
if
((
newname
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
1
])))
==
NULL
)
return
(
JS_TRUE
);
*
rval
=
BOOLEAN_TO_JSVAL
(
rename
(
oldname
,
newname
)
==
0
);
return
(
JS_TRUE
);
}
static
JSBool
static
JSBool
js_isdir
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
js_isdir
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
...
@@ -1325,6 +1340,9 @@ static jsMethodSpec js_global_functions[] = {
...
@@ -1325,6 +1340,9 @@ static jsMethodSpec js_global_functions[] = {
{
"file_remove"
,
js_remove
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename"
)
{
"file_remove"
,
js_remove
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename"
)
,
JSDOCSTR
(
"delete a file"
)
,
JSDOCSTR
(
"delete a file"
)
},
},
{
"file_rename"
,
js_rename
,
2
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"oldname newname"
)
,
JSDOCSTR
(
"rename a file"
)
},
{
"file_isdir"
,
js_isdir
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename"
)
{
"file_isdir"
,
js_isdir
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename"
)
,
JSDOCSTR
(
"check if directory"
)
,
JSDOCSTR
(
"check if directory"
)
},
},
...
@@ -1375,16 +1393,16 @@ static jsMethodSpec js_global_functions[] = {
...
@@ -1375,16 +1393,16 @@ static jsMethodSpec js_global_functions[] = {
{
"base64_decode"
,
js_b64_decode
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text"
)
{
"base64_decode"
,
js_b64_decode
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"returns base64-decoded text string or <i>null</i> on error"
)
,
JSDOCSTR
(
"returns base64-decoded text string or <i>null</i> on error"
)
},
},
{
"md5"
,
js_md5_calc
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text [,bool hex]"
)
{
"md5
_calc
"
,
js_md5_calc
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"string text [,bool hex]"
)
,
JSDOCSTR
(
"calculate and return MD5 digest of string encoded in base64 (default) or hexadecimal"
)
,
JSDOCSTR
(
"calculate and return MD5 digest of string encoded in base64 (default) or hexadecimal"
)
},
},
{
"crc16"
,
js_crc16
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
{
"crc16
_calc
"
,
js_crc16
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"calculate and return 16-bit CRC of text string"
)
,
JSDOCSTR
(
"calculate and return 16-bit CRC of text string"
)
},
},
{
"crc32"
,
js_crc32
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
{
"crc32
_calc
"
,
js_crc32
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"calculate and return 32-bit CRC of text string"
)
,
JSDOCSTR
(
"calculate and return 32-bit CRC of text string"
)
},
},
{
"chksum"
,
js_chksum
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
{
"chksum
_calc
"
,
js_chksum
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string text"
)
,
JSDOCSTR
(
"calculate and return 32-bit checksum of text string"
)
,
JSDOCSTR
(
"calculate and return 32-bit checksum of text string"
)
},
},
{
0
}
{
0
}
...
...
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