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

strtoull() moved from os_win32.c to new int64_vc6.c to support cygwin builds

parent a8ade403
No related branches found
No related tags found
No related merge requests found
/*
* 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;
}
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment