]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - os_win32/syslogevt.c
Imported Upstream version 5.40+svn3296
[mirror_smartmontools-debian.git] / os_win32 / syslogevt.c
index 73e1230d1f7a8edb538984d08d61c1435a20a0e9..08019fec17fe8dcf0ec9cf75d7dcbe5b150f911d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2004-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  *
  */
 
-static char rcsid[] = "$Id: syslogevt.c,v 1.5 2008/03/04 22:09:48 ballen4705 Exp $";
+static char rcsid[] = "$Id: syslogevt.c 3257 2011-02-14 22:19:42Z manfred99 $";
 
 #include <stdio.h>
 #include <string.h>
@@ -25,15 +25,17 @@ static char rcsid[] = "$Id: syslogevt.c,v 1.5 2008/03/04 22:09:48 ballen4705 Exp
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-#ifdef _DEBUG
 #include "syslogevt.h"
-#endif
+// Compile time check for Message Ids, see also syslog_win32.cpp
+typedef assert_msg_syslog   [MSG_SYSLOG    ==  0 ? 1 : -1];
+typedef assert_msg_syslog_01[MSG_SYSLOG_01 ==  1 ? 1 : -1];
+typedef assert_msg_syslog_10[MSG_SYSLOG_10 == 10 ? 1 : -1];
 
 
 static int usage()
 {
        puts(
-               "syslogevt $Revision: 1.5 $ Copyright (C) 2004-8 Christian Franke\n"
+               "syslogevt $Revision: 3257 $ Copyright (C) 2004-10 Christian Franke\n"
                "Home page is http://smartmontools.sourceforge.net/\n"
                "\n"
                "Usage: syslogevt [-ru] name [ident ...]\n"
@@ -67,12 +69,6 @@ main(int argc, char ** argv)
        const char * ident;
        FILE * f1, * f2;
 
-#ifdef _DEBUG
-       if (!(MSG_SYSLOG == 0 && MSG_SYSLOG_01 == 1 && MSG_SYSLOG_10 == 10)) {
-               puts("Internal error: MSG_SYSLOG_n != n"); return 1;
-       }
-#endif
-
        if (argc < 2)
                return usage();
 
@@ -106,7 +102,7 @@ main(int argc, char ** argv)
                perror(name1); return 1;
        }
        if (!(f2 = fopen(name2, "w"))) {
-               perror(name2); unlink(name1); return 1;
+               perror(name2); fclose(f1); unlink(name1); return 1;
        }
 
        fputs("REGEDIT4\n\n", f1);