1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Allow to store an arbitrary pointer in the context.

Added assuan_write_status().
This commit is contained in:
Werner Koch 2001-11-19 12:40:30 +00:00
parent 2b2a800a77
commit f375790d24
4 changed files with 60 additions and 0 deletions

View file

@ -354,5 +354,45 @@ assuan_process (ASSUAN_CONTEXT ctx)
}
void
assuan_write_status (ASSUAN_CONTEXT ctx, const char *keyword, const char *text)
{
char buffer[256];
char *helpbuf;
size_t n;
if ( !ctx || !keyword)
return;
if (!text)
text = "";
n = 2 + strlen (keyword) + 1 + strlen (text) + 1;
if (n < sizeof (buffer))
{
strcpy (buffer, "S ");
strcat (buffer, keyword);
if (*text)
{
strcat (buffer, " ");
strcat (buffer, text);
}
_assuan_write_line (ctx, buffer);
}
else if ( (helpbuf = xtrymalloc (n)) )
{
strcpy (helpbuf, "S ");
strcat (helpbuf, keyword);
if (*text)
{
strcat (helpbuf, " ");
strcat (helpbuf, text);
}
_assuan_write_line (ctx, helpbuf);
xfree (helpbuf);
}
}