diff options
author | ZoRo <dos21h@gmail.com> | 2020-05-05 20:56:49 +0100 |
---|---|---|
committer | ZoRo <dos21h@gmail.com> | 2020-05-05 20:56:49 +0100 |
commit | 54da7a3169200cba754b176383ee35bf75401429 (patch) | |
tree | 7c5e55b8811d9de85911687f48c338b635a336ef /main.c | |
download | MATCH-2-54da7a3169200cba754b176383ee35bf75401429.tar.gz MATCH-2-54da7a3169200cba754b176383ee35bf75401429.zip |
Initial version of second version of MATCH
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 89 |
1 files changed, 89 insertions, 0 deletions
@@ -0,0 +1,89 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include <unistd.h> +#include <sys/types.h> +#include <signal.h> +#include <getopt.h> +#include <sys/stat.h> +#include <ctype.h> +#include <fcntl.h> + +#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 |