diff --git a/sm5/utility.cpp b/sm5/utility.cpp index b267ba3f154657f0b6ee771a2e7bb14d5c45b955..0a541ee34ec8bfb8eb34290f7d1d090a72982157 100644 --- a/sm5/utility.cpp +++ b/sm5/utility.cpp @@ -27,19 +27,23 @@ // SMARTCTL, OR BOTH. #include <stdio.h> -#include <unistd.h> #include <string.h> #include <time.h> #include <errno.h> #include <stdlib.h> #include <ctype.h> +#ifndef _WIN32 #include <syslog.h> +#else +#define LOG_CRIT 2 +#define LOG_DAEMON (3<<3) +#endif #include <stdarg.h> #include "utility.h" #include "config.h" // Any local header files should be represented by a CVSIDX just below. -const char* utility_c_cvsid="$Id: utility.cpp,v 1.28 2003/11/09 20:22:21 ballen4705 Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; +const char* utility_c_cvsid="$Id: utility.cpp,v 1.28.2.1 2004/02/23 15:41:32 chrfranke Exp $" CONFIG_H_CVSID UTILITY_H_CVSID; const char * packet_types[] = { "Direct-access (disk)", @@ -314,8 +318,8 @@ int split_report_arg2(char *s, int *i){ // "selective,%lld-%lld" (prefixes of "0" (for octal) and "0x"/"0X" (for hex) // are allowed). The first long long int is assigned to *start and the second // to *stop. Returns zero if successful and non-zero otherwise. -int split_selective_arg(char *s, unsigned long long *start, - unsigned long long *stop) +int split_selective_arg(char *s, uint64_t *start, + uint64_t *stop) { char *tailptr; @@ -336,7 +340,7 @@ int split_selective_arg(char *s, unsigned long long *start, return 0; } -long long bytes = 0; +int64_t bytes = 0; // Helps debugging. If the second argument is non-negative, then // decrement bytes by that amount. Else decrement bytes by (one plus) // length of null terminated string. @@ -404,18 +408,22 @@ char *CustomStrDup(char *ptr, int mustexist, int whatline, char* file){ // values. This means the objects of type char or short int (whether // signed or not) are promoted to either int or unsigned int, as // appropriate.] -extern int facility; void PrintOut(int priority,char *fmt, ...){ va_list ap; // initialize variable argument list va_start(ap,fmt); if (debugmode) vprintf(fmt,ap); - else { + else +#ifndef _WIN32 + { openlog("smartd",LOG_PID, facility); vsyslog(priority,fmt,ap); closelog(); } +#else + vfprintf(stderr, fmt, ap); +#endif va_end(ap); return; }