.c -> .cpp
Fix various warnings in badblocks, and fix broken build due to missing includes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ AddResources checkitout : checkitout.rdef ;
|
|||||||
|
|
||||||
# standard commands that don't need any additional library
|
# standard commands that don't need any additional library
|
||||||
StdBinCommands
|
StdBinCommands
|
||||||
badblocks.c
|
badblocks.cpp
|
||||||
cal.c
|
cal.c
|
||||||
chop.c
|
chop.c
|
||||||
clear.c
|
clear.c
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
// for R5:
|
// for R5:
|
||||||
@@ -10,7 +13,7 @@ int blockSize = 1024;
|
|||||||
int group = 64;
|
int group = 64;
|
||||||
int progress = 1;
|
int progress = 1;
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
FILE *outputFile = stdout;
|
FILE *outputFile = NULL;
|
||||||
|
|
||||||
int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
||||||
{
|
{
|
||||||
@@ -49,7 +52,7 @@ int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
|||||||
continue;
|
continue;
|
||||||
if (got >= 0) {
|
if (got >= 0) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "block %Ld (offset %Ld): got %d < %d\n",
|
fprintf(stderr, "block %Ld (offset %Ld): got %d < %zd\n",
|
||||||
block, at, got, len);
|
block, at, got, len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -71,7 +74,7 @@ int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
|||||||
if (got < 0)
|
if (got < 0)
|
||||||
fprintf(stderr, "block %Ld: error: %s\n", block + i, strerror(errno));
|
fprintf(stderr, "block %Ld: error: %s\n", block + i, strerror(errno));
|
||||||
else
|
else
|
||||||
fprintf(stderr, "block %Ld: read % bytes\n", block + i, got);
|
fprintf(stderr, "block %Ld: read %d bytes\n", block + i, got);
|
||||||
fprintf(outputFile, "%Ld\n", block + i);
|
fprintf(outputFile, "%Ld\n", block + i);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@@ -81,7 +84,6 @@ int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err2:
|
|
||||||
close(fd);
|
close(fd);
|
||||||
err1:
|
err1:
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@@ -100,6 +102,7 @@ int main(int argc, char **argv)
|
|||||||
int ch;
|
int ch;
|
||||||
off_t startBlock = 0LL;
|
off_t startBlock = 0LL;
|
||||||
off_t endBlock = INT64_MAX;
|
off_t endBlock = INT64_MAX;
|
||||||
|
outputFile = stdout;
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return usage(1);
|
return usage(1);
|
||||||
|
|
||||||
Reference in New Issue
Block a user