Make puts append a newline

This commit is contained in:
pjht 2019-09-08 13:01:01 -05:00
parent bad2fe8823
commit 0bd3fe70cb

View File

@ -198,7 +198,14 @@ size_t fread(void* buffer_ptr,size_t size,size_t count,FILE* stream) {
}
int puts(const char *s) {
return fputs(s,stdout);
char* str=malloc(sizeof(char)*(strlen(s)+2));
strcpy(str,s);
str[strlen(s)]='\n';
str[strlen(s)+1]='\0';
serial_print(str);
int code=fputs(str,stdout);
free(str);
return code;
}
int fputs(const char* s, FILE* stream) {