Commit Graph

93 Commits

Author SHA1 Message Date
Red Bear OS 628d5c2a51 0.3.0: add dual-toolchain VaList ABI probe and macros (relibc check passes) 2026-07-06 20:33:17 +03:00
vasilito 5004e94d1d 0.3.0: fix relibc build for Rust 2024 + VaList API (cargo check passes) 2026-07-06 19:37:02 +03:00
vasilito 4ef7e57571 0.3.0: converge relibc to upstream 0.6.0 + Red Bear patches 2026-07-06 19:13:57 +03:00
Jeremy Soller 94a6da9116 Fix lookahead buffer reading nul's 2020-12-23 08:20:11 -07:00
oddcoder ab92ff9d41 make all ld printlns happen in case of verbose = true and apply cargo fmt
It seams that stdout of ld.so is not that much of an issue but actually
it unfortunately is. The major problem here is that sometimes programs
generate header files in stdout (./getmy_custom_headers > header.h) and
we need to keep that cleen. and this is very very popular in gcc.
2020-08-12 18:57:37 +02:00
jD91mZM2 72532b8280 Fix printf issue found in GDB 2020-08-05 16:49:10 +02:00
Wren Turkal 9a1e9c327a Make byte stream functions set stream orientation.
When a byte-oriented stream function touches a stream, that stream
should be set to byte-oriented mode if it hasn't been set yet. If
it has been set, the opertion should only succeed if the stream is
already in byte-oriented mode.

Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:11 -07:00
Wren Turkal 746a86a267 Add unlocked variation of fwide function.
Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:11 -07:00
Wren Turkal b623e245c0 Make freopen reset the stream orientation.
Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:11 -07:00
Wren Turkal 865b7962a1 Add implmentation for fwide posix function.
This function is used to set the orientation of a stream to either
byte-oriented or wchar-oriented.

More info on this function is here:
https://man7.org/linux/man-pages/man3/fwide.3p.html

This implementation only impmlemnts the manual switching and does
not yet guard against using a byte-oriented stream with wchar
functions and vice versa. Those step will come in additional
commits.

Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:06 -07:00
jD91mZM2 56e1eceb28 Replace AllocStringWriter with CVec 2020-06-29 17:44:57 +02:00
jD91mZM2 593925ceb4 Unambiguate all include guards
GNU binutils also uses _FNMATCH_H for a guard, maybe along others!
2020-06-29 11:34:51 +02:00
oddcoder 92d6735e3f Add more scanf tests 2020-06-03 23:20:53 +02:00
oddcoder 8973535fdc Make scanf write to string and increase match count only when a pattern is matched
This is the behavior of glibc which I assume to be right
2020-06-03 23:20:52 +02:00
oddcoder a49139ca2f use lookahead buffer in inner_scanf 2020-06-03 23:20:52 +02:00
oddcoder 14e011b72c Implemment lookaheadreader with lookahead and commit api
The LookAheadReader api works similar to read but it has 2 methods,
lookahead: it will read 1 byte (with internal ftell) without modifying
the file's own ftell() and commit() which saves the current file ftell

LookAheadReader can wrap both buffers and files
2020-06-03 23:20:52 +02:00
oddcoder f068673adc Separate the logic from locking in ftello and fseeko 2020-06-03 23:20:52 +02:00
oddcoder ee5e2bad5a Support negative padding size in printf and friends
as it seams you can do something like
        printf ("A%*s%s/\n", -5, "B", "CC");
and it will print the padding to the left
2020-05-23 16:20:20 +02:00
oddcoder d7d3e00867 Fix off-by-1 error in vfscanf
Scanf function requires look ahead to function properly, In case of
scanning from a buffer that will not be an issue, but in our case we are
reading from file, so lookaheads needs to be undone (via lseek) in our
case. The only problem here is that if we opened a file that doesn't
support lseek such as many of the file /dev/*
2020-05-23 16:20:20 +02:00
oddcoder 1733b3da6e Fix bug related to ungetc and ftell()
At least in relibc, each call to ungetc should decrement ftell() by one
also allowing negative ftell() this is not possible on relibc thus gcc
failing to compile (gcc compiles tools that is later used to compile gcc
itself and these tools are the ones that fail)
2020-05-23 16:20:20 +02:00
oddcoder 7a6f96373e Add support for multiple unget at the same time
According to the standards, only one ungetc may be guaranteed however
glibc allows more than one of those, and to be glibc compatiable, one
needs to be able to do the same, allowing only 1 ungetc may trigger bug
while compiling gcc as ungetc is used there alot
2020-05-23 16:20:20 +02:00
oddcoder 4a47bc4a6f Fix regressing in printf padding with space
There was bug in printf where space paddings cause segfault,
the problem was that it was pulled from the stack twice while it should
be only done once.
2020-05-08 22:38:42 +02:00
Peter Limkilde Svendsen 74555698fb Handle infinity and NaN in printf 2019-12-05 01:37:17 +00:00
jD91mZM2 b8c50c7c64 Format 2019-08-04 19:05:45 +02:00
jD91mZM2 c7d499d4f2 Upgrade to the 2018 edition
I didn't think it'd be this useful first, but thank god for `cargo fix --edition`!
2019-08-04 19:05:45 +02:00
jD91mZM2 43ff8801bc Format 2019-08-04 19:05:44 +02:00
jD91mZM2 35c1d5210c Implement the Once<T> synchronization structure
Not sure if I should add a RwLock for the ptrace state too...
2019-08-04 19:05:44 +02:00
jD91mZM2 a8280e8991 Implement wcstol, wcstod, and printf:ing wchars 2019-07-18 12:29:22 +02:00
jD91mZM2 a2c8cfb4a5 Implement CVec, an abstraction to return vectors from Rust 2019-07-18 06:40:23 +02:00
jD91mZM2 29b5b989eb Format 2019-07-11 18:20:27 +02:00
jD91mZM2 1a0f72dad8 Fix CI & compatibility with older rust 2019-07-11 18:18:17 +02:00
jD91mZM2 57917c0e92 Fix various floating point issues in printf 2019-07-11 18:09:37 +02:00
Mateusz Mikuła 63a1319e50 Cbindgen update 2019-07-10 10:08:39 +00:00
Jeremy Soller 05f71567ab Format 2019-07-06 19:37:13 -06:00
jD91mZM2 2f4e57f87a Fix data race inside puts(...) & add dbg!() macro 2019-06-26 21:21:32 +02:00
Mateusz Mikuła 7597c082e7 Fix Clippy warnings 2019-05-11 22:34:13 +02:00
Alex Lyon 68d3c5f1b1 Format code 2019-04-26 20:40:22 -07:00
Alex Lyon 3584edf199 stdio: implement tempnam() and tmpnam() 2019-04-26 20:39:03 -07:00
jD91mZM2 8fca7bcbc1 More printf tests and corner cases 2019-04-23 08:15:58 +02:00
jD91mZM2 0a0aec502b Fix #140 2019-04-23 07:34:06 +02:00
jD91mZM2 40d01d9d57 Convert printf internals to iterator 2019-04-22 16:25:29 +02:00
Jeremy Soller 7bde036031 Remove va_list submodule, format 2019-04-21 15:45:55 -06:00
jD91mZM2 6d4ac9dba8 Finally, get rid of all rust warnings
Just a small step along the way to reduce the massive wall of spam
every time you compile.

This was done partly automagically with `cargo fix`. The rest was me
deleting or commenting out a bunch of variables. Hope nothing was
important...
2019-04-21 21:12:16 +02:00
Dan Robertson fa94f1b6d5 Use core::ffi::VaList 2019-04-21 17:46:22 +02:00
jD91mZM2 3f98962054 Fix bug in scanf where EOF would be ignored 2019-03-28 17:57:13 +01:00
Jeremy Soller 6548aad36d Use next_byte function in all places in scanf 2019-03-27 21:32:02 -06:00
Jeremy Soller c71088e768 Cleanup and format 2019-01-14 21:07:24 -07:00
Jeremy Soller 62b83190bf Fix incorrect variable name 2018-12-29 10:03:11 -07:00
Jeremy Soller e7896f6c48 Fix panic in fread 2018-12-29 10:02:36 -07:00
lmiskiew 5b6b11cb65 Fix panic in fwrite 2018-12-17 02:01:36 +01:00