[31] in Moira
unportable use of stdio in moira library
daemon@ATHENA.MIT.EDU (Mark Rosenstein)
Mon Jan 29 18:14:20 1990
Date: Mon, 29 Jan 90 18:13:47 -0500
From: Mark Rosenstein <mar@MIT.EDU>
To: jfc@ATHENA.MIT.EDU
Cc: bug-moira@ATHENA.MIT.EDU
In-Reply-To: John Carr's message of Sat, 13 Jan 90 07:05:44 EST <9001131205.AA03621@ACHATES.MIT.EDU>
After some deliberation, I've fixed this in a slightly less kludgy way
that's still non-portable. Some day we'll have ANSI-compliant C
libraries on all of our machines, and then we can use vsprintf().
-Mark
/* This routine sends a class SMS zephyrgram of specified instance
* and logs to a special logfile the message passed to it via msg
* and args in printf format. *** It expects the global variable
* whoami to be defined and contain the name of the calling program.
* It's a kludge that it takes a max of 8 arguments in a way that
* isn't necessarily portable, but varargs doesn't work here and we
* don't have vsprintf().
*/
void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8)
char *instance; /* Instance for zephyr gram */
char *msg; /* printf format message */
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8;
{
FILE *crit; /* FILE for critical log file */
char buf[BUFSIZ]; /* Holds the formatted message */
sprintf(buf, msg, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
...