]> andersk Git - moira.git/commitdiff
remove non-portable code stolen from sprintf()
authormar <mar>
Mon, 29 Jan 1990 18:09:43 +0000 (18:09 +0000)
committermar <mar>
Mon, 29 Jan 1990 18:09:43 +0000 (18:09 +0000)
lib/critical.c

index c3502e036d4e73db9f2c06c89e305c246627e7af..6b4dd527a43f449a93108d69f822f44b02479845 100644 (file)
 extern char *whoami;
 
 
-void critical_alert(instance, msg, args)
+/* 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 */
-                               /* args = arguements, printf style */
-  /* 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. */
-  /* Note: The part of this code that process the variable arguements
-     was stolen from sprintf(). */
+  char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8;
 {
-    FILE _bufstr;              /* For _doprnt() */
     FILE *crit;                        /* FILE for critical log file */
     char buf[BUFSIZ];          /* Holds the formatted message */
 
-    /* Put the fully formatted message into buf */
-    _bufstr._flag = _IOWRT + _IOSTRG;
-    _bufstr._ptr = buf;
-    _bufstr._cnt = BUFSIZ;
-    _doprnt(msg, &args, &_bufstr);
-    putc('\0', &_bufstr);
+    sprintf(buf, msg, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
 
     /* Send zephyr notice */
     send_zgram(instance, buf);
This page took 0.043905 seconds and 5 git commands to generate.