summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2022-12-04 16:47:47 +0100
committerVincent Douillet <vincent@vdouillet.fr>2022-12-04 16:47:47 +0100
commit47fd551daab476421411749c5806b3c213cf0a70 (patch)
treec52d4976f129b43417599d326356b5174dde5983 /input.c
parent56d350f318f8cf9b580852b123d505845abad84e (diff)
day 4
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;
+}
+