From 94ba99e2ccdfaf862af6ce039ae447eb244c9283 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 3 Apr 2004 05:42:49 +0000 Subject: Prep for unix porting --- src/list.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/list.c') diff --git a/src/list.c b/src/list.c index 28f2952..f93f3c0 100644 --- a/src/list.c +++ b/src/list.c @@ -33,6 +33,7 @@ const char kPrintData[] = "\ "; const char kPrintDrive[] = "\nDrive: %u\n"; +const char kPrintDrivePath[] = "\nDrive: %s\n"; const char kPrintDriveInfo[] = " %-15u %-15u "; const char kPrintNTFSInfo[] = "%-15u %-15u"; @@ -45,8 +46,7 @@ int printNTFSInfo(int dd, uint64 tblSector) pos = SECTOR_TO_BYTES(tblSector); - /* PORT: Windows specific */ - if(_lseeki64(dd, pos, SEEK_SET) == -1) + if(lseek64(dd, pos, SEEK_SET) == -1) err(1, "couldn't seek drive"); sz = read(dd, §or, kSectorSize); @@ -75,8 +75,7 @@ int printPartitionInfo(int dd, uint64 tblSector) pos = SECTOR_TO_BYTES(tblSector); - /* PORT: Windows specific */ - if(_lseeki64(dd, pos, SEEK_SET) == -1) + if(lseek64(dd, pos, SEEK_SET) == -1) err(1, "couldn't seek drive"); sz = read(dd, &mbr, sizeof(drive_mbr)); @@ -120,7 +119,7 @@ void scroungeList() { makeDriveName(driveName, i); - dd = open(driveName, _O_BINARY | _O_RDONLY); + dd = open(driveName, _O_BINARY | _O_RDONLY | OPEN_LARGE_OPTS); if(dd != -1) { printf(kPrintDrive, i); @@ -129,3 +128,14 @@ void scroungeList() } } } + +void scroungeListDrive(char* drive) +{ + int dd = open(driveName, _O_BINARY | _O_RDONLY | OPEN_LARGE_OPTS; + if(dd == -1) + err(1, "couldn't open drive: %s", driveName); + + printf(kPrintDrivePath, driveName); + printPartitionInfo(dd, 0); + close(dd); +} -- cgit v1.2.3