version 1.1.1.1, 2012/02/21 16:32:16
|
version 1.1.1.2, 2013/07/22 01:17:36
|
Line 3
|
Line 3
|
* |
* |
* Home page of code is: http://smartmontools.sourceforge.net |
* Home page of code is: http://smartmontools.sourceforge.net |
* |
* |
* Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net> | * Copyright (C) 2004-12 Christian Franke <smartmontools-support@lists.sourceforge.net> |
* |
* |
* This program is free software; you can redistribute it and/or modify |
* 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 |
* it under the terms of the GNU General Public License as published by |
Line 11
|
Line 11
|
* any later version. |
* any later version. |
* |
* |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
* (for example COPYING); if not, write to the Free | * (for example COPYING); If not, see <http://www.gnu.org/licenses/>. |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
* |
* |
*/ |
*/ |
|
|
// Win32 Emulation of syslog() for smartd |
// Win32 Emulation of syslog() for smartd |
// Writes to windows event log on NT4/2000/XP |
// Writes to windows event log on NT4/2000/XP |
// (Register syslogevt.exe as event message file) |
// (Register syslogevt.exe as event message file) |
// Writes to file "<ident>.log" on 9x/ME. |
|
// If facility is set to LOG_LOCAL[0-7], log is written to |
// If facility is set to LOG_LOCAL[0-7], log is written to |
// file "<ident>.log", stdout, stderr, "<ident>[1-5].log". |
// file "<ident>.log", stdout, stderr, "<ident>[1-5].log". |
|
|
Line 35
|
Line 33
|
#define WIN32_LEAN_AND_MEAN |
#define WIN32_LEAN_AND_MEAN |
#include <windows.h> // RegisterEventSourceA(), ReportEventA(), ... |
#include <windows.h> // RegisterEventSourceA(), ReportEventA(), ... |
|
|
const char *syslog_win32_c_cvsid = "$Id$" | const char *syslog_win32_cpp_cvsid = "$Id$" |
SYSLOG_H_CVSID; | SYSLOG_H_CVSID; |
|
|
#ifdef _MSC_VER |
#ifdef _MSC_VER |
// MSVC |
// MSVC |
Line 350 void openlog(const char *ident, int logopt, int facili
|
Line 348 void openlog(const char *ident, int logopt, int facili
|
// Cannot open => Use logfile |
// Cannot open => Use logfile |
long err = GetLastError(); |
long err = GetLastError(); |
strcat(strcpy(sl_logpath, sl_ident), ".log"); |
strcat(strcpy(sl_logpath, sl_ident), ".log"); |
if (GetVersion() & 0x80000000) | fprintf(stderr, "%s: Cannot register event source (Error=%ld), writing to %s\n", |
fprintf(stderr, "%s: No event log on Win9x/ME, writing to %s\n", | sl_ident, err, sl_logpath); |
sl_ident, sl_logpath); | |
else | |
fprintf(stderr, "%s: Cannot register event source (Error=%ld), writing to %s\n", | |
sl_ident, err, sl_logpath); | |
} |
} |
else { |
else { |
// Start event log thread |
// Start event log thread |