summaryrefslogtreecommitdiff
path: root/main.c
blob: dc573372c0dc87db870faa1b2255ecb969eb2c70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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;
}