Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit a8b56c32 authored by rswindell's avatar rswindell

Created global truncsp method (truncates space off end of string).

parent 710cc84c
...@@ -332,6 +332,25 @@ js_strip_exascii(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r ...@@ -332,6 +332,25 @@ js_strip_exascii(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
return(JS_TRUE); return(JS_TRUE);
} }
static JSBool
js_truncsp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
char* p;
JSString* js_str;
if((js_str=JS_ValueToString(cx, argv[0]))==NULL)
return(JS_FALSE);
if((p=JS_GetStringBytes(js_str))==NULL)
return(JS_FALSE);
truncsp(p);
js_str = JS_NewStringCopyZ(cx, p);
*rval = STRING_TO_JSVAL(js_str);
return(JS_TRUE);
}
static JSBool static JSBool
js_fexist(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) js_fexist(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
...@@ -617,6 +636,7 @@ static JSFunctionSpec js_global_functions[] = { ...@@ -617,6 +636,7 @@ static JSFunctionSpec js_global_functions[] = {
{"ascii_str", js_ascii_str, 1}, /* convert ex-ascii in str to plain ascii */ {"ascii_str", js_ascii_str, 1}, /* convert ex-ascii in str to plain ascii */
{"strip_ctrl", js_strip_ctrl, 1}, /* strip ctrl chars from string */ {"strip_ctrl", js_strip_ctrl, 1}, /* strip ctrl chars from string */
{"strip_exascii", js_strip_exascii, 1}, /* strip ex-ascii chars from string */ {"strip_exascii", js_strip_exascii, 1}, /* strip ex-ascii chars from string */
{"truncsp", js_truncsp, 1}, /* truncate space off end of string */
{"file_exists", js_fexist, 1}, /* verify file existence */ {"file_exists", js_fexist, 1}, /* verify file existence */
{"file_remove", js_remove, 1}, /* delete a file */ {"file_remove", js_remove, 1}, /* delete a file */
{"file_isdir", js_isdir, 1}, /* check if directory */ {"file_isdir", js_isdir, 1}, /* check if directory */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment