Skip to content

Commit b623384

Browse files
Update input.c
1 parent ce0532e commit b623384

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

code/logic/input.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,14 @@ int fossil_io_validate_sanitize_string(const char *input, char *output, size_t o
304304

305305
return 1;
306306
}
307+
308+
int fossil_io_gets(char *buffer, size_t size) {
309+
if (fgets(buffer, size, stdin) == NULL) {
310+
return -1; // Error or EOF
311+
}
312+
size_t len = strlen(buffer);
313+
if (len > 0 && buffer[len - 1] == '\n') {
314+
buffer[len - 1] = '\0'; // Remove newline character
315+
}
316+
return 0; // Success
317+
}

0 commit comments

Comments
 (0)