diff options
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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; +} + |