Commit graph

51 commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen
611dc22e73 Standardize header include guards.
This change makes all the standard library and kernel headers use header
guards with a consistent scheme within the reserved namespace to avoid
conflicts with non-standard-library-implementation code.
2022-07-09 20:51:13 +02:00
Jonas 'Sortie' Termansen
221fa7d954 Rewrite scanf(3) to be standards compliant.
This change adds missing features:

* %[ for pattern matching with a scanset.
* %m for allocation of strings.
* %p for pointers.
* Field width for integers.

The following features remain unimplemented, like with printf(3):

* Floating point support.
* Wide character support.
* %n$ positional parameters.

The code has been completely refactored to be much more maintainable.

The implemented features should now be standards compliant. A large number
of edge cases have been fixed.

The vscanf_callback(3) function has been renamed to vcbscanf(3) and a new
cbscanf(3) function has been added.
2020-03-07 23:31:05 +01:00
Jonas 'Sortie' Termansen
6135c5414b Remove UL suffix from BUFSIZ. 2016-10-03 20:02:11 +02:00
Jonas 'Sortie' Termansen
2b72262b4f Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.

All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.

All imported code from other projects is compatible with this license.

All GPL licensed code from other projects had previously been removed.

Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-05 22:21:50 +01:00
Jonas 'Sortie' Termansen
bb73362d23 Create stdio buffers at FILE creation time.
This removes support for user-supplied buffers with setvbuf.
2016-01-26 18:39:48 +01:00
Jonas 'Sortie' Termansen
213b3636bb Add open_memstream(3). 2015-08-26 18:10:24 +02:00
Jonas 'Sortie' Termansen
3ef38cf936 Remove P_tmpdir. 2015-08-26 16:49:18 +02:00
Jonas 'Sortie' Termansen
a79aeed0c1 Remove __BEGIN_DECLS and __END_DECLS. 2015-08-26 14:52:44 +02:00
Jonas 'Sortie' Termansen
3750de1f11 Rename struct FILE to struct __FILE. 2015-08-22 01:29:37 +02:00
Jonas 'Sortie' Termansen
91ab47f99c Deprecate stdio_ext API. 2015-08-21 21:25:01 +02:00
Jonas 'Sortie' Termansen
3a3fc76c8c Remove tmpnam(3). 2014-12-02 18:00:38 +01:00
Jonas 'Sortie' Termansen
36c70760a0 Warn on sprintf use. 2014-12-02 18:00:23 +01:00
Jonas 'Sortie' Termansen
ec7e0cc9a6 Add cbprintf(3) and vcbprintf(3).
Thanks to Owen Shepherd of the Public Domain C Library for helping design
and formalize these interfaces.
2014-12-01 21:39:05 +01:00
Jonas 'Sortie' Termansen
8643c37102 Remove __flbf(3). 2014-12-01 21:39:05 +01:00
Jonas 'Sortie' Termansen
2f393b2646 Remove _flushlbf(3). 2014-12-01 21:39:05 +01:00
Jonas 'Sortie' Termansen
3778dae725 Remove __fsetlocking(3). 2014-12-01 21:39:05 +01:00
Jonas 'Sortie' Termansen
5e60007904 Remove dcloseall() and fcloseall(). 2014-12-01 16:29:43 +01:00
Jonas 'Sortie' Termansen
571daf8aaf Honor feature macros in <stdio.h>. 2014-11-20 21:09:15 +01:00
Jonas 'Sortie' Termansen
fbbb33287b Implement standard library feature macros. 2014-11-20 21:09:14 +01:00
Jonas 'Sortie' Termansen
c428ec4d83 Add fmemopen(3). 2014-11-17 18:47:44 +01:00
Jonas 'Sortie' Termansen
d7c54161b2 Revise stdio implementation. 2014-10-19 17:13:49 +02:00
Jonas 'Sortie' Termansen
01f6606b74 Fix FILE being a macro. 2014-09-25 17:49:01 +02:00
Jonas 'Sortie' Termansen
771dc573ee Add attribute format to standard library headers. 2014-08-23 21:47:05 +02:00
Jonas 'Sortie' Termansen
1ddd404ff9 Thread-secure stdio. 2014-07-08 17:41:52 +02:00
Jonas 'Sortie' Termansen
2fe13d33c9 Add asprintf(3) and vasprintf(3). 2014-03-17 19:22:12 +01:00
Jonas 'Sortie' Termansen
1986bc2ba2 Add vscanf_callback(3). 2014-03-17 19:22:12 +01:00
Jonas 'Sortie' Termansen
b08455c4d3 Remove mxmpp. 2014-03-01 14:37:40 +01:00
Jonas 'Sortie' Termansen
a4220d5b5f Fix incorrect usage of __is_sortix_foo macros in preprocessor conditionals.
These macros might not be defined, in which case this usage would have
generated warnings had they not been in system headers.
2014-01-18 16:30:55 +01:00
Jonas 'Sortie' Termansen
30a95dfa1e Split parts of <features.h> into <sys/cdefs.h>. 2013-12-17 14:30:44 +01:00
Jonas 'Sortie' Termansen
e901ad8105 Move the declaration of the FILE structure into its own header. 2013-12-17 14:30:43 +01:00
Jonas 'Sortie' Termansen
4e520c8c36 Remove sortix_gets(3). 2013-12-17 14:30:43 +01:00
Jonas 'Sortie' Termansen
9700623737 Remove obsolete __SORTIX_SHOW_UNIMPLEMENTED feature macro. 2013-12-17 14:30:42 +01:00
Jonas 'Sortie' Termansen
ad1c6e0ed7 Remove <sys/__/types.h> inclusion from <features.h>. 2013-12-17 14:30:42 +01:00
Jonas 'Sortie' Termansen
5b6d49b060 Remove useless extern keyword from libc header function prototypes. 2013-12-17 14:30:42 +01:00
Jonas 'Sortie' Termansen
f79508fbc9 Remove __POSIX_OBSOLETE feature macro. 2013-12-17 14:30:42 +01:00
Jonas 'Sortie' Termansen
3a30ba57ef Change libc internal build macro to __is_sortix_libc. 2013-12-17 14:30:42 +01:00
Jonas 'Sortie' Termansen
bb2a1b3e73 Add dprintf(3) and vdprintf(3). 2013-12-17 14:30:40 +01:00
Jonas 'Sortie' Termansen
2f49694031 Add flockfile(3), ftrylockfile(3), and funlockfile(3). 2013-12-17 14:30:40 +01:00
Jonas 'Sortie' Termansen
28a4fe477b Add tmpnam(3). 2013-12-17 14:30:33 +01:00
Jonas 'Sortie' Termansen
12947b0bdf Add fgetpos(3) and fsetpos(3). 2013-12-17 14:30:33 +01:00
Jonas 'Sortie' Termansen
3eeec255c0 Use alternate restrict keyword when unavailable. 2013-12-17 14:30:32 +01:00
Jonas 'Sortie' Termansen
8cc4c6cb03 Add tmpfile(3). 2013-12-17 14:30:31 +01:00
Jonas 'Sortie' Termansen
476b27c301 Refactor FILE creation and destruction. 2013-12-17 14:30:29 +01:00
Jonas 'Sortie' Termansen
a90e6d5d16 Implement stdio line buffering semantics. 2013-12-17 14:30:29 +01:00
Jonas 'Sortie' Termansen
e8e5f14a5d Add popen(3) and pclose(3). 2013-12-17 14:30:27 +01:00
Jonas 'Sortie' Termansen
9ad7690c74 Rewrite stdio functions.
These changes aim to make the stdio functions much more stable, flexible,
correct and bugfree.
2013-12-17 14:30:26 +01:00
Jonas 'Sortie' Termansen
8e0aefda20 Add rename(2) and renameat(2). 2013-12-17 14:30:26 +01:00
Jonas 'Sortie' Termansen
500d853f77 Add removeat(3) and split remove(3) into its own file. 2013-12-17 14:30:25 +01:00
Jonas 'Sortie' Termansen
90036ca6a8 Update copyright headers of old files to the current format. 2013-12-17 14:30:23 +01:00
Jonas 'Sortie' Termansen
92b029b07f Remove tabs from header include guards. 2013-12-17 14:30:23 +01:00