From 38d60726082b04e79edae1c8c797c6dcb8314504 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 25 Aug 2002 14:39:48 +0000 Subject: Workiiiiiiiiiiiiiiiiiing!!!! --- crypto-search.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'crypto-search.cpp') 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 #include #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 \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; } -- cgit v1.2.3