From cb40b16b11dc2c32596128c815147ef8b2ec8cce Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Wed, 25 Feb 2004 12:59:55 +0000 Subject: [PATCH] strtoull() moved from os_win32.c to new int64_vc6.c to support cygwin builds git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/branches/RELEASE_5_26_WIN32_BRANCH@1517 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/os_win32/int64_vc6.c | 47 +++++++++++++++++++++++++++++++++++ sm5/os_win32/os_win32.c | 25 +++---------------- sm5/os_win32/smartctl_vc6.dsp | 4 +++ 3 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 sm5/os_win32/int64_vc6.c diff --git a/sm5/os_win32/int64_vc6.c b/sm5/os_win32/int64_vc6.c new file mode 100644 index 000000000..566ca8789 --- /dev/null +++ b/sm5/os_win32/int64_vc6.c @@ -0,0 +1,47 @@ +/* + * int64_vc6.c + * + * Home page of code is: http://smartmontools.sourceforge.net + * + * Copyright (C) 2004 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * You should have received a copy of the GNU General Public License + * (for example COPYING); if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code was originally developed as a Senior Thesis by Michael Cornwell + * at the Concurrent Systems Laboratory (now part of the Storage Systems + * Research Center), Jack Baskin School of Engineering, University of + * California, Santa Cruz. http://ssrc.soe.ucsc.edu/ + * + */ + +#include "int64.h" + +#include <stdio.h> +#include <errno.h> + +const char *int64_vc6_c_cvsid = "$Id: int64_vc6.c,v 1.1.2.1 2004/02/25 12:59:55 chrfranke Exp $" \ +INT64_H_CVSID; + + +// strtoull() is missing in MSVC 6.0 +// Used by utility:split_selective_arg() + +__int64 strtoull(char * s, char ** end, int base) +{ + __int64 val; int n = -1; + if (sscanf(s, "%I64i%n", &val, &n) != 1 && n <= 0) { + if (end) + *end = s; + errno = EINVAL; return -1; + } + if (end) + *end = s + n; + return val; +} diff --git a/sm5/os_win32/os_win32.c b/sm5/os_win32/os_win32.c index 094af6bbc..fbf84bdb5 100644 --- a/sm5/os_win32/os_win32.c +++ b/sm5/os_win32/os_win32.c @@ -36,27 +36,10 @@ extern smartmonctrl * con; // con->permissive // Needed by '-V' option (CVS versioning) of smartd/smartctl -const char *os_XXXX_c_cvsid="$Id: os_win32.c,v 1.1.2.1 2004/02/23 15:02:24 chrfranke Exp $" \ +const char *os_XXXX_c_cvsid="$Id: os_win32.c,v 1.1.2.2 2004/02/25 12:59:55 chrfranke Exp $" \ ATACMDS_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID EXTERN_H_CVSID; -// Quick hack strtoull() for MSVC 6.0 using sscanf -// Used by utility:split_selective_arg() - -__int64 strtoull(char * s, char ** end, int base) -{ - __int64 val; int n = -1; - if (sscanf(s, "%I64i%n", &val, &n) != 1 && n <= 0) { - if (end) - *end = s; - errno = EINVAL; return -1; - } - if (end) - *end = s + n; - return val; -} - - static int ata_open(int drive); static void ata_close(int fd); static int aspi_open(unsigned adapter, unsigned id); @@ -374,7 +357,7 @@ static int ide_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, u buf->DataBufferSize = datasize; #ifdef _DEBUG - pout("DeviceIoControl(.,0x%lx,.,%lu,.,%lu,.,NULL)\n", + pout("DeviceIoControl(.,0x%x,.,%u,.,%u,.,NULL)\n", IOCTL_IDE_PASS_THROUGH, size, size); print_ide_regs(&buf->IdeReg, 0); #endif @@ -808,7 +791,7 @@ static int aspi_io_call(ASPI_SRB * srb) } else { pout("WaitForSingleObject(%lx) = 0x%lx,%ld, Error=%ld\n", - event, rc, rc, GetLastError()); + (unsigned long)event, rc, rc, GetLastError()); } // TODO: ASPI_ABORT_IO command aspi_entry = 0; @@ -891,7 +874,7 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) } else j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n"); - pout(buff); + pout(buff); } memset(&srb, 0, sizeof(srb)); diff --git a/sm5/os_win32/smartctl_vc6.dsp b/sm5/os_win32/smartctl_vc6.dsp index 43661dd72..783e9dc54 100644 --- a/sm5/os_win32/smartctl_vc6.dsp +++ b/sm5/os_win32/smartctl_vc6.dsp @@ -181,6 +181,10 @@ SOURCE=..\int64.h # End Source File # Begin Source File +SOURCE=.\int64_vc6.c +# End Source File +# Begin Source File + SOURCE=..\knowndrives.c # End Source File # Begin Source File -- GitLab