summaryrefslogtreecommitdiff
path: root/crypto-search.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-25 14:39:48 +0000
committerPixel <Pixel>2002-08-25 14:39:48 +0000
commit38d60726082b04e79edae1c8c797c6dcb8314504 (patch)
tree4a056a158c6fc21c29dd8d8ed94c010a25cee19a /crypto-search.cpp
parent1b0a5db816b7610c83615e93095155b1709f55da (diff)
Workiiiiiiiiiiiiiiiiiing!!!!
Diffstat (limited to 'crypto-search.cpp')
-rw-r--r--crypto-search.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/crypto-search.cpp b/crypto-search.cpp
index 8775095..4ece311 100644
--- a/crypto-search.cpp
+++ b/crypto-search.cpp
@@ -23,11 +23,12 @@
#include <string.h>
#include <unistd.h>
#include "generic.h"
-#include "fileutils.h"
+#include "Input.h"
int main(int argc, char ** argv) {
- int h, size, mind, maxd, delta, len, i, j;
+ int size, mind, maxd, delta, len, i, j;
char * buffer, * str;
+ Handle * h;
if (argc != 3) {
printm(M_BARE, "Usage: %s <inputfile> <needle>\n", argv[0]);
@@ -36,23 +37,21 @@ int main(int argc, char ** argv) {
verbosity = M_INFO;
- if ((h = open(argv[1], O_RDONLY)) < 0) {
- printm(M_ERROR, "Unable to open file %s\n", argv[1]);
- exit(-1);
- }
+ h = new Input(argv[1]);
str = argv[2];
- size = filesize(h);
+ size = h->GetSize();
printm(M_STATUS, "Requesting memory (%i bytes)\n", size);
if (!(buffer = (char *) malloc(size))) {
printm(M_ERROR, "Not enough memory.\n");
+ delete h;
exit(-1);
}
printm(M_STATUS, "Loading file...\n");
- read(h, buffer, size);
+ h->read(buffer, size);
printm(M_STATUS, "Done, initialising the search.\n");
len = strlen(argv[2]);
@@ -88,4 +87,6 @@ int main(int argc, char ** argv) {
}
}
}
+
+ delete h;
}