3b86f87c76
libc: Support %i in printf()
...
Which is the same as %d.
2022-11-03 16:53:19 +01:00
948361bec5
printf: Show which format specifier is unknown
2022-10-30 18:08:29 +01:00
8d46c9bbe2
Kernel, libc: Fix a big bug in printf()
...
Every time printf flushes the buffer to us in sprintf() or snprintf(), we call strncat to append the data.
But we want to start from the beginning in the first flush. What if there was data already there?
Well, we just append to the old data. Which is not good, and breaks snprintf()'s maximum size policy.
This fix sets the first byte of str to NULL, to avoid this.
2022-10-30 09:53:23 +01:00
b17ff6319a
libc: compilation fix for libc's printf
2022-10-24 20:47:00 +02:00
33f6765a5c
libc: Make the userspace printf much better
2022-10-24 17:21:40 +02:00
0f47f59364
libc: make fprintf actually write to the chosen file
...
Also, printf now is kind of an alias for fprintf(stdout,...), as it should be.
2022-10-11 21:10:19 +02:00
93f6be9319
libc: Implement the start of a FILE* API (the standard, portable C way of doing file stuff)
2022-10-10 21:08:57 +02:00
49c7900407
Add %m to userspace printf
...
%m as a format specifier is a nonstandard glibc extension, but I like it so I'm implementing it.
What it does is print the value of strerror(errno), without consuming any arguments to printf().
2022-10-08 18:44:14 +02:00
3ee1f34bc4
Forgot to add break :)
...
And that, is why you test before pushing and commiting >.<
2022-10-08 18:08:50 +02:00
c67079dd74
Kernel, libc: Implement %p in *printf()
...
So we can avoid writing (unsigned long)ptr or (uint64_t)ptr everywhere when wanting to print a pointer.
2022-10-08 18:07:33 +02:00
028a1b1a3c
libc: Enable even more warnings
2022-10-07 18:19:06 +02:00
48b858af5a
libc: Add strncpy and strncat, and deprecate strcpy and strcat (which, since we're building with -Werror, is an instant ban from using these functions)
2022-10-04 19:08:59 +02:00
885e39f60f
libc: fix printf to actually print correct more-than-one-digit numbers (hint: the bugfix was a very stupid one)
2022-10-03 20:30:12 +02:00
cb60e418b2
Add vprintf, (v)sprintf and (v)snprintf to libc + move the non v-printfs to stdio.cpp, since they can now call their v-variants and thus don't depend on internal_printf
2022-10-03 19:59:33 +02:00
34aa953dbc
Add printf() and puts(), quite primitive, looks like hex printing isn't there yet...
2022-10-03 19:00:10 +02:00