Commit graph

21 commits

Author SHA1 Message Date
cinap_lenrek d4e89fe76a ape: fix wrong write size for _assert() 2022-03-14 11:16:11 +00:00
cinap_lenrek 85bfb0e9eb reduce: use if() to test for exit status of pipeline
The new rc's exit status will be '' for a successfull
pipeline execution instead of '|'.

This is a bit too tightly coupled, so just use if()
statement instead, handling this in a portable way.
2022-01-10 02:01:11 +00:00
Benjamin Riefenstahl bf322dfbf3 ape/mkstemp: better options
Use O_EXCL and make the file descriptor writeable.  This is more
usefull and it conforms to Single Unix and other specs.
2021-12-10 20:44:26 +00:00
Ori Bernstein 2db3642b8d strndup: don't assume buffer is terminated
Using strlen in strndup will walk past the first
n bytes up to the terminator, which may not be
present. This is not what we want.

While we're here, do some cleanups.
2020-12-18 07:16:29 -08:00
Ori Bernstein 658c1b9f68 libap: add strndup
strndup is part of POSIX.1, so APE should provide it.
This patch adds it, so need to patch it out of fewer
programs going forward.
2020-12-17 19:20:04 -08:00
Ori Bernstein ec533a1ad8 ape/ctype.h: add isblank, fix functions (thanks staalmannen)
Our ctype.h mistakenly ommitted isblank. Add it in.

While we're here, the make the 'isfoo()' functions
are broken: they're offsetting into the array, and
don't work with negative character values.

Sync the function bodies with the macros, and make
them produce correct results.
2020-08-29 11:09:20 -07:00
Ori Bernstein 73f38fc546 [ape] add missing conversion flags for scanf
We're missing type flags for:

	hh: char
	ll: vlong
	z:  size_t
	t:  ptrdiff_t
	j:  intmax_t

The lack of '%lld' was causing us to fail when parsing
timezone files. This brings us in line with the specifiers
in the C99 standard, section 7.19.6.2p11
2020-05-12 10:48:33 -07:00
Roberto E. Vargas Caballero 42240127a7 ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile 2019-09-09 17:27:57 +01:00
Roberto E. Vargas Caballero e0720a48b0 Add mkstemp to stdlib.h
q
2019-09-09 15:58:39 +01:00
Ori Bernstein d4bc9052be Turn on warnings when building libap.
For ape, we never enabled warnings in cflags.
Turning it on brings up a lot of warnings. Most are noise,
but a few caught unused variables and trunctaions of pointers.
to smaller integers (int, long).

A few warnings remain.
2019-06-21 10:00:58 -07:00
spew 55c122d59f ape: add strnlen 2018-06-21 11:56:37 -04:00
cinap_lenrek 333812ca38 ape: fix mktime() again 2015-08-04 02:00:37 +02:00
cinap_lenrek 43ae553195 ape: remove local copy of memccpy() 2014-01-20 00:05:19 +01:00
cinap_lenrek 7143b286b7 ape: move strdup() from libbsd to libap (from sources)
including <string.h> should be enougth to make strdup()
available.
2013-12-28 05:14:10 +01:00
cinap_lenrek 6cadd03bbe fix utf and rune handling in preparation for 32bit runes 2012-12-31 21:09:46 +01:00
cinap_lenrek ee251568fb ape: putenv, add file :) 2012-12-03 06:47:01 +01:00
cinap_lenrek 84c930a078 ape: fix putenv()
writing /env in putenv() doesnt work. exec will create
new enviroment anyway. we have to modify environ array!
2012-12-03 06:44:30 +01:00
cinap_lenrek be0301f458 calloc: check multiplication overflow 2012-08-19 10:50:39 +02:00
aiju 7a4e46d7ab fixed mktime bug 2011-06-03 13:06:28 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00