summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/input.c b/input.c
index 1c72194..5a3500a 100644
--- a/input.c
+++ b/input.c
@@ -72,3 +72,14 @@ void input_str_free(struct input_str* input) {
}
free(input->lines);
}
+
+char* copy_line(char* line) {
+ int len = strlen(line);
+ char* copy = malloc(len * sizeof(char));
+ if(copy == NULL)
+ err(1, "malloc error");
+ memset(copy, '\0', len);
+ strncpy(copy, line, len);
+ return copy;
+}
+