about summary refs log tree commit diff
path: root/mseq.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-17 21:51:41 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-17 21:51:41 +0200
commit796531b22db24b48192ab4f00a22e1606726fcb6 (patch)
tree16540f3a75683fd3e0b9a2ca24213d09a3196f45 /mseq.c
parent66544292ff8d1073872efd9a1ca6fc0325556a96 (diff)
downloadmblaze-796531b22db24b48192ab4f00a22e1606726fcb6.tar.gz
mblaze-796531b22db24b48192ab4f00a22e1606726fcb6.tar.xz
mblaze-796531b22db24b48192ab4f00a22e1606726fcb6.zip
mseq: extract code into seq.c
Diffstat (limited to 'mseq.c')
-rw-r--r--mseq.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/mseq.c b/mseq.c
index 7c65c8e..776966d 100644
--- a/mseq.c
+++ b/mseq.c
@@ -10,28 +10,7 @@
 #include <limits.h>
 #include <errno.h>
 
-char *
-seq_open(char *file)
-{
-	int fd;
-	struct stat st;
-
-	// env $SEQ or something
-	if (!file)
-		file = "map";
-	fd = open(file, O_RDONLY);
-	if (!fd)
-		return 0;
-
-	fstat(fd, &st);
-	char *map = mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-	close(fd);
-
-	if (map == MAP_FAILED)
-		return 0;
-
-	return map;
-}
+#include "blaze822.h"
 
 static const char *
 readlin(const char *p)
@@ -84,7 +63,7 @@ parse_relnum(char *a, long cur, long last, long *out)
 int
 main(int argc, char *argv[])
 {
-	char *map = seq_open(0);
+	char *map = blaze822_seq_open(0);
 	if (!map)
 		return 1;