]> andersk Git - moira.git/blobdiff - lib/critical.c
Diane Delgado's changes for a fixed table-locking order
[moira.git] / lib / critical.c
index 6b4dd527a43f449a93108d69f822f44b02479845..7d5df7f1f18b0448a0502cc467ebe64aef00adcb 100644 (file)
@@ -7,21 +7,18 @@
  *  <mit-copyright.h>.
  */
 
-/* At Athena, we use zephyr & not syslog.  Change the following line 
- * if necessary */
-#define ZEPHYR
-
-
 #include <mit-copyright.h>
 #include <stdio.h>
+#include <sys/types.h>
 #include <sys/file.h>
+#include <moira_site.h>
 #ifdef ZEPHYR
 #include <zephyr/zephyr.h>
 #endif
 #ifdef SYSLOG
 #include <syslog.h>
 #endif
-#include <sms_app.h>
+#include <string.h>
 
 
 /* mode to create the file with */
@@ -30,7 +27,7 @@
 extern char *whoami;
 
 
-/* This routine sends a class SMS zephyrgram of specified instance
+/* This routine sends a class MOIRA 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.
@@ -56,7 +53,7 @@ void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
     /* Log message to critical file */
     if ((crit = fopen(CRITERRLOG, "a")) != (FILE *)NULL) 
     {
-       long t;
+       long t, time();
        char  *time_s;
 
        time(&t);
@@ -72,7 +69,7 @@ void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
 
 
 
-/* Sends a zephyrgram of class "SMS", instance as a parameter.  Ignores
+/* Sends a zephyrgram of class "MOIRA", instance as a parameter.  Ignores
  * errors while sending message.
  */
 
@@ -83,11 +80,15 @@ char *msg;
 #ifdef ZEPHYR
     ZNotice_t znotice;
 
+#ifdef POSIX
+    memset (&znotice, 0, sizeof (znotice));
+#else
     bzero (&znotice, sizeof (znotice));
+#endif
     znotice.z_kind = UNSAFE;
-    znotice.z_class = "SMS";
+    znotice.z_class = "MOIRA";
     znotice.z_class_inst = inst;
-    znotice.z_default_format = "SMS $instance:\n $message\n";
+    znotice.z_default_format = "MOIRA $instance on $fromhost:\n $message\n";
     (void) ZInitialize ();
     znotice.z_message = msg;
     znotice.z_message_len = strlen(msg) + 1;
@@ -98,7 +99,7 @@ char *msg;
 #ifdef SYSLOG
     {
        char buf[512];
-       sprintf(buf, "SMS: %s %s", inst, msg);
+       sprintf(buf, "MOIRA: %s %s", inst, msg);
        syslog(LOG_ERR, buf);
     }
 #endif
This page took 0.056443 seconds and 4 git commands to generate.