Skip to content
Snippets Groups Projects
Commit 1f9d96a8 authored by chrfranke's avatar chrfranke
Browse files

Win32 port: unused includes removed, dummy syslog defs added,

long long replaced by int64_t.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/branches/unlabeled-1.28.2@1507 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 0cb960e0
No related branches found
No related tags found
No related merge requests found
...@@ -27,19 +27,23 @@ ...@@ -27,19 +27,23 @@
// SMARTCTL, OR BOTH. // SMARTCTL, OR BOTH.
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#ifndef _WIN32
#include <syslog.h> #include <syslog.h>
#else
#define LOG_CRIT 2
#define LOG_DAEMON (3<<3)
#endif
#include <stdarg.h> #include <stdarg.h>
#include "utility.h" #include "utility.h"
#include "config.h" #include "config.h"
// Any local header files should be represented by a CVSIDX just below. // 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[] = { const char * packet_types[] = {
"Direct-access (disk)", "Direct-access (disk)",
...@@ -314,8 +318,8 @@ int split_report_arg2(char *s, int *i){ ...@@ -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) // "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 // are allowed). The first long long int is assigned to *start and the second
// to *stop. Returns zero if successful and non-zero otherwise. // to *stop. Returns zero if successful and non-zero otherwise.
int split_selective_arg(char *s, unsigned long long *start, int split_selective_arg(char *s, uint64_t *start,
unsigned long long *stop) uint64_t *stop)
{ {
char *tailptr; char *tailptr;
...@@ -336,7 +340,7 @@ int split_selective_arg(char *s, unsigned long long *start, ...@@ -336,7 +340,7 @@ int split_selective_arg(char *s, unsigned long long *start,
return 0; return 0;
} }
long long bytes = 0; int64_t bytes = 0;
// Helps debugging. If the second argument is non-negative, then // Helps debugging. If the second argument is non-negative, then
// decrement bytes by that amount. Else decrement bytes by (one plus) // decrement bytes by that amount. Else decrement bytes by (one plus)
// length of null terminated string. // length of null terminated string.
...@@ -404,18 +408,22 @@ char *CustomStrDup(char *ptr, int mustexist, int whatline, char* file){ ...@@ -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 // values. This means the objects of type char or short int (whether
// signed or not) are promoted to either int or unsigned int, as // signed or not) are promoted to either int or unsigned int, as
// appropriate.] // appropriate.]
extern int facility;
void PrintOut(int priority,char *fmt, ...){ void PrintOut(int priority,char *fmt, ...){
va_list ap; va_list ap;
// initialize variable argument list // initialize variable argument list
va_start(ap,fmt); va_start(ap,fmt);
if (debugmode) if (debugmode)
vprintf(fmt,ap); vprintf(fmt,ap);
else { else
#ifndef _WIN32
{
openlog("smartd",LOG_PID, facility); openlog("smartd",LOG_PID, facility);
vsyslog(priority,fmt,ap); vsyslog(priority,fmt,ap);
closelog(); closelog();
} }
#else
vfprintf(stderr, fmt, ap);
#endif
va_end(ap); va_end(ap);
return; return;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment