| T X T _ B S T R N P C A T ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English INDEP - TXT_#?
----------------------------------------------------------------------------
NAME
txt_bstrnpcat() - Concatenate BCPL string to NULL term.
string.
SYNOPSIS
res = txt_bstrnpcat(dst, src, dlen);
LONG txt_bstrnpcat(LONG *, LONG, LONG *);
FUNCTION
This function appends BCPL string to NULL terminated one.
INPUTS
dst - Pointer to a var. that holds dest. address.
src - Source BCPL string.
dlen - Pointer to a var. that holds dest. len.
RETURNS
Returns 0 if everything went fine or negative or positive
value on overflow.
BASES
None.
NOTES
This function does not iterate to find end of the string,
so it is much faster and much safier than 'txt_bstrncat()',
but you should still NULL terminate the very first byte of
the string!
This f. comes with two more variants: 'txt_bstrnpcatlc()' &
'txt_bstrnpcatuc()' who allow to transform the text on the
fly to lower or upper case.
To compute how long the string is you just subtract 'dlen'
from 'dst' capacity.
Beware! Never create BCPL address to data put on stack!!!
All addresses to be BCPLed must be multiple of 4!
SEE ALSO
EXAMPLE
...
#define SIZE 256
...
/*
* This is how BCPL string look likes, first byte is length
* of the string and then the string. Pay attention to this
* 'static' it causes data not to be put on stack.
*/
UBYTE buf[SIZE] = {0};
static UBYTE bcplstr[] = {11, 'B', 'C', 'P', 'L', ' ',
's', 'u', 'c', 'k', 's', '!'};
LONG bcplptr = QDEV_HLP_MKBADDR(bcplstr); /* Non-direct ptr! */
LONG size = SIZE;
LONG addr = (LONG)&buf[0];
txt_bstrnpcat(&addr, bcplptr, &size);
BUGS
None known.
----------------------------------------------------------------------------
| |
| |