]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/events.c
Eliminate dependency on man2html.
[bacula/bacula] / bacula / src / lib / events.c
index 6e602076b9cd5080d3b4e9d61b9b7edbdf7187eb..c89c413f02437dcc2d86771a5a0f65dccbeca31a 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2001-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -54,11 +54,11 @@ void log_event(UPSINFO *ups, int level, char *fmt, ...)
 
        time(&nowtime);
        localtime_r(&nowtime, &tm);
-        strftime(datetime, sizeof(datetime), "%a %b %d %X %Z %Y  ", &tm);
+       strftime(datetime, sizeof(datetime), "%a %b %d %X %Z %Y  ", &tm);
        write(event_fd, datetime, strlen(datetime));
        lm = strlen(msg);
-        if (msg[lm-1] != '\n') 
-           msg[lm++] = '\n';
+       if (msg[lm-1] != '\n')
+          msg[lm++] = '\n';
        write(event_fd, msg, lm);
     }
 }
@@ -68,7 +68,7 @@ void log_event(UPSINFO *ups, int level, char *fmt, ...)
 #define MAXLE 50                     /* truncate file when this many events */
 
 /*
- * If the EVENTS file exceeds MAXLE records, truncate it. 
+ * If the EVENTS file exceeds MAXLE records, truncate it.
  *
  * Returns:
  *
@@ -84,7 +84,7 @@ int truncate_events_file(UPSINFO *ups)
     int trunc = FALSE;
     FILE *events_file;
     int stat = 0;
-    
+
     if ((events_file = fopen(ups->eventfile, "r+")) == NULL)
        return 0;
     for (i=0; i<NLE; i++)
@@ -114,7 +114,7 @@ int truncate_events_file(UPSINFO *ups)
     *buf = 0;
     /* Put records in single buffer in correct order */
     for (j=0; j < nrec; j++) {
-       strcat(buf, le[i++]); 
+       strcat(buf, le[i++]);
        if (i >= NLE)
            i = 0;
     }
@@ -138,38 +138,36 @@ bailout:
 
 #endif /* IMPLEMENTED */
 
-#ifdef HAVE_CYGWIN
-
-#include <windows.h>
+#if defined(HAVE_WIN32)
 
 extern UPSINFO myUPS;
 extern int shm_OK;
 
-/*  
+/*
  * Fill the Events list box with the last events
- * 
+ *
  */
 void FillEventsBox(HWND hwnd, int idlist)
 {
     char buf[1000];
     int len;
     FILE *events_file;
-    
+
     if (!shm_OK || myUPS.eventfile[0] == 0 ||
-        (events_file = fopen(myUPS.eventfile, "r")) == NULL) {
-       SendDlgItemMessage(hwnd, idlist, LB_ADDSTRING, 0, 
-           (LONG)"Events not available");
+       (events_file = fopen(myUPS.eventfile, "r")) == NULL) {
+       SendDlgItemMessage(hwnd, idlist, LB_ADDSTRING, 0,
+          (LONG)_("Events not available"));
        return;
     }
 
     while (fgets(buf, sizeof(buf), events_file) != NULL) {
        len = strlen(buf);
        /* strip trailing cr/lfs */
-        while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r'))
+       while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r'))
            buf[--len] = 0;
        SendDlgItemMessage(hwnd, idlist, LB_ADDSTRING, 0, (LONG)buf);
     }
     return;
 }
 
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_WIN32 */