From 54da7a3169200cba754b176383ee35bf75401429 Mon Sep 17 00:00:00 2001 From: ZoRo Date: Tue, 5 May 2020 20:56:49 +0100 Subject: Initial version of second version of MATCH --- main.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..dc57337 --- /dev/null +++ b/main.c @@ -0,0 +1,89 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rabincarp.h" + +int file_open( const char *fname ) +{ + int fd; + + fd = open( fname, O_RDONLY ); + if ( fd == -1 ) + { + printf("Couldn open file %s\n", fname); + return -1; + } + + return fd; +} + +int file_read( int fd, char *buf, int size ) +{ + int ret; + + if ( size < 1 ) + return -1; + + ret = (int)read( fd, buf, size ); + + return ret; +} + +int file_seek( int fd, off_t pos ) +{ + off_t rc; + + if (fd<1) + { + return -1; + } + + rc = lseek( fd, pos, SEEK_SET ); + if (rc == -1) + return -1; + return 0; + +} + +int file_close( int fd ) +{ + close( fd ); + return 0; +} + +typedef struct match_params +{ + char *fname; + char *match_str; + int verbose; +} match_params; + + +void helper( char *progname ) +{ + printf("Usage: %s [OPTS]\n\n" + " -f - input file\n" + " -m - match string\n" + " -v - more extra info in output\n" + "Version: 0.0.1 \n" + "\n" + , progname); +} + +int main(int argc, const char *argv[]) +{ + + + + + return 0; +} \ No newline at end of file -- cgit v1.2.3