Listing 5 Msg will call PrintString in order to convert the printf argument list into a static string.

#include <stdarg.h>

char *PrintString(const char *fmt, ...)
/* Convert printf() arguments into a static string. */
{
   va_list   args;
   static char line[999];
   
   va_start(args, fmt);
   vsprintf(line, fmt, args);
   va_end(args);
   return line;

}

void Msg(const char *fmt, ...)
/* Send message to stdout user. */
{
   char *line;
   
   line = PrintString(fmt);
   print("%s\n", line);
   ...
}

/* End of File */