From 698ae18f535c3e388b6ebcdca1582005a29ff2f2 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Mon, 29 Feb 2016 11:52:16 +0000
Subject: [PATCH] Tape is in the dump and successfully restored.

---
 src/io.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/io.c b/src/io.c
index e7461d6..0a6cd57 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1000,6 +1000,20 @@
 
 
 ts_tape *parsetape(char *filename){
+	FILE *fd = fopen (filename, "r");
+	long length;
+	size_t size;
+	fseek (fd, 0, SEEK_END);
+  	length = ftell (fd);
+	fseek (fd, 0, SEEK_SET);
+	size=fread (tapetxt, 1, length, fd);
+	fclose(fd);
+	if(size);
+	ts_tape *tape=parsetapebuffer(tapetxt);
+	return tape;
+}
+
+ts_tape *parsetapebuffer(char *buffer){
     ts_tape *tape=(ts_tape *)calloc(1,sizeof(ts_tape));
     tape->multiprocessing=calloc(255,sizeof(char));
 
@@ -1038,7 +1052,7 @@
     cfg_t *cfg;    
     ts_uint retval;
     cfg = cfg_init(opts, 0);
-    retval=cfg_parse(cfg, filename);
+    retval=cfg_parse_buf(cfg, buffer);
     if(retval==CFG_FILE_ERROR){
 	fatal("No tape file.",100);
 	}

--
Gitblit v1.9.3