Commit f5614022 authored by Niels Möller's avatar Niels Möller
Browse files

Added %S format.

Rev: src/format.c:1.4
Rev: src/format.h:1.4
parent 21c18269
......@@ -73,6 +73,14 @@ UINT32 ssh_vformat_length(char *f, va_list args)
if (!literal)
length += 4;
}
break;
case 'S':
length += va_arg(args, struct lsh_string *)->length;
f++;
if (!literal)
length += 4;
break;
case 'a':
{
......@@ -177,6 +185,21 @@ void ssh_vformat(char *f, UINT8 *buffer, va_list args)
f++;
}
break;
case 'S':
{
struct lsh_string *s = va_arg(args, struct lsh_string *);
if (!literal)
{
WRITE_UINT32(buffer, s->length);
buffer += 4;
}
memcpy(buffer, s->data, s->length);
buffer += s->length;
f++;
}
case 'a':
{
UINT32 length;
......
......@@ -22,6 +22,8 @@
*
* %s Insert a string, given by a length and a pointer.
*
* %S Insert a string, given as a struct lsh_string pointer.
*
* %a Insert a string containing one atom.
*
* %A Insert a string containing a list of atoms. The corresponding
......
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