.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:
+3
-3
@@ -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
|
||||||
@@ -125,7 +125,7 @@ StdBinCommands
|
|||||||
spybmessage.cpp
|
spybmessage.cpp
|
||||||
urlwrapper.cpp
|
urlwrapper.cpp
|
||||||
: be $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ;
|
: be $(TARGET_LIBSUPC++) : $(haiku-utils_rsrc) ;
|
||||||
|
|
||||||
# commands that need libbe.so, libsupc++.so and liblocale.so
|
# commands that need libbe.so, libsupc++.so and liblocale.so
|
||||||
StdBinCommands
|
StdBinCommands
|
||||||
dstcheck.cpp
|
dstcheck.cpp
|
||||||
@@ -208,7 +208,7 @@ StdBinCommands
|
|||||||
StdBinCommands
|
StdBinCommands
|
||||||
watch.c
|
watch.c
|
||||||
: libncurses.a : $(haiku-utils_rsrc) ;
|
: libncurses.a : $(haiku-utils_rsrc) ;
|
||||||
|
|
||||||
# Localization of some applications
|
# Localization of some applications
|
||||||
DoCatalogs dstcheck :
|
DoCatalogs dstcheck :
|
||||||
x-vnd.Haiku-cmd-dstconfig
|
x-vnd.Haiku-cmd-dstconfig
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -34,7 +37,7 @@ int scan_device(const char *dev, off_t startBlock, off_t endBlock)
|
|||||||
// Check size
|
// Check size
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "Scanning '%s', %d * %d bytes at once\n",
|
fprintf(stderr, "Scanning '%s', %d * %d bytes at once\n",
|
||||||
dev, group, blockSize);
|
dev, group, blockSize);
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
@@ -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);
|
||||||
|
|
||||||
@@ -133,6 +136,6 @@ int main(int argc, char **argv)
|
|||||||
startBlock = atoll(argv[2]);
|
startBlock = atoll(argv[2]);
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
endBlock = atoll(argv[1]);
|
endBlock = atoll(argv[1]);
|
||||||
|
|
||||||
return scan_device(argv[0], startBlock, endBlock);
|
return scan_device(argv[0], startBlock, endBlock);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user