Sophie

Sophie

distrib > Mageia > 4 > i586 > media > core-release > by-pkgid > 07a81589bb2c4aa5e88f35a4a345a184 > files > 190

maradns-1.4.13-2.mga4.i586.rpm

.\" Process this file with
.\" groff -man -Tascii cryptday.1
.\"
.TH js_insert 3 "August 2000" JS "js library reference"
.\" We don't want hyphenation (it's too ugly)
.\" We also disable justification when using nroff
.hy 0
.if n .na
.SH NAME
js_insert \- insert one js_string string inside another js_string object
.SH SYNOPSIS
.nf
.B #include "JsStr.h"
.sp
.B "int js_insert(js_string *toinsert, js_string *target, int where)"
.fi
.SH DESCRIPTION
.B js_insert
inserts the string inside the
.I js_string
object 
.B toinsert
in to the 
.I js_string
object
.B target
starting at 
.B where
bytes from the beginning of the string.

The number
.B where
determines the number of bytes in the 
.B target 
string before we insert the
.B toinsert
string.  If
.B where
has a value of 0, we prepend 
.B toinsert
before 
.B target,
if 
.B where 
has a value of 1, we insert the string
.B toinsert
after the first byte of the string
.B target,
and so on.

.SH ARGUMENTS
.B toinsert
is a pointer to the  
.I js_string
object we will place insert inside 
.B target.

.B target
is the 
.I js_string
object that the 
.B toinsert
string will be inserted in to.

.B where
is the number of bytes in 
.B target
before the inserted string
.B toinsert.
.SH "RETURN VALUE"
.B js_insert
returns 
.I JS_SUCCESS 
on successful insertion of the string,
.I JS_ERROR
otherwise.
.SH EXAMPLE
The following example will give foo the string "1234567890":

.nf
	js_string *foo, *bar;
	foo = js_create(256,1);
	bar = js_create(256,1);
	js_str2js(foo,"1267890",10,1);
	js_str2js(bar,"345",3,1);
	js_insert(bar,foo,2); /* foo is now "1234567890" */
.fi
.SH AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>