summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/scanf.cpp
AgeCommit message (Collapse)Author
2021-10-24LibC: Fix `%n` conversion specifier in scanf() formatJelle Raaijmakers
Also add a test to prevent this from happening again. There were two bugs: * The number of bytes just after processing the last value was written, instead of the number of bytes after skipping remaining whitespace. Confirmed by testing against GNU's `scanf()` since the man page leaves something to be desired. * The number of bytes was written to the wrong variable argument; i.e. the first argument was overwritten.
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-07-17LibC: Make scanf always copy its va_listPeter Bindels
On x86_64 GCC implements va_list as an array. This makes the syntax for taking a pointer to it break & crash. The workaround / solution is to create a copy. Since va_list is a tiny struct referencing the actual varargs, this is little overhead (especially compared to va_args itself)
2021-07-04LibC: Convert LengthModifier & ConversionSpecifier to enum classesIdan Horowitz
These were preventing some AK classes from using the AK Concepts header due to the non-strictly namespaced ConversionSpecifier::Unsigned, and are not used as their underlying value, so enum classes are more appropriate anyways.
2021-05-06LibC: Make scanf() not increment the assignment count for %nGunnar Beutner
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18LibC: Implement assignment suppression for vsscanfGunnar Beutner
The vsscanf library function lets the user skip assigning parsed values to the arguments, e.g. with %*c - even though a character is scanned it is not assigned to one of the arguments. The figlet port uses this. With this patch the port is actually usable.
2021-04-10AK+Everywhere: Make StdLibExtras templates less wrapper-yAnotherTest
This commit makes the user-facing StdLibExtras templates and utilities arguably more nice-looking by removing the need to reach into the wrapper structs generated by them to get the value/type needed. The C++ standard library had to invent `_v` and `_t` variants (likely because of backwards compat), but we don't need to cater to any codebase except our own, so might as well have good things for free. :^)
2021-04-08LibC: Fix coding style in scanf helpersAndreas Kling
2021-04-04LibC: Teach `vsscanf()` to consume the width specifierJelle Raaijmakers
Previously, `vsscanf()` would crash whenever it encountered a width specification. Now, it consumes the width specification but does not yet do anything with it.
2021-04-04LibC: Use 'long long' specialisations of scanf's read_element_concreteAnotherTest
...for 'long long' and 'unsigned long long', instead of reading them as 'long's and 'unsigned long's. Also add a test for values that can only fit in (unsigned) long long. Fixes #6096.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-02-25LibC: Make it compile on 64-bitAndreas Kling
It won't actually work on 64-bit yet, but let's do our future selves a favor and make it compile.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-16LibC: Teach scanf how to read "%lu" and "%llu" (unsigned long{, long})AnotherTest
This makes the gcc port work again.
2021-02-15LibC: Reimplement scanf from the ground upAnotherTest
This adds support for some previously unsupported features (e.g. length modifiers) and fixes at least one FIXME. Fixes #90.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling