summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c89
1 files changed, 89 insertions, 0 deletions
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 <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