Compare commits

..
Author SHA1 Message Date
Colin Percival 882b9f3f22 Update in preparation for 13.5-RELEASE
- Bump BRANCH to RELEASE
- Add the anticipated RELEASE announcement date
- Set a static __FreeBSD_version

Approved by:	re (implicit)
Sponsored by:	Amazon
2025-03-07 00:00:00 +00:00
Colin Percival a24b044a1e 13.5: Update to RC1
Approved by:	re (implicit)
Sponsored by:	Amazon
2025-02-27 16:48:37 -08:00
Colin Percival 956fb94dd6 13.5: Switch from "quarterly" to "release" pkgs
Approved by:	re (implicit)
Sponsored by:	Amazon
2025-02-27 16:48:26 -08:00
Olivier Certner cf411e5ed3 queue: Fix STAILQ_ASSERT_EMPTY()
The 'while' part corresponding to the 'do' was missing.

Did not notice the problem as later commits using it have been stashed
and never reworked up to now, and it is currently unused in the tree.

While here, fix spacing after the '#define' in the !(_KERNEL &&
INVARIANS) part.

Fixes:          34740937f7 ("queue: New debug macros for STAILQ")
MFC after:      1 minute
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit d3c4b002d1)
(cherry picked from commit 4fd887f08b)

Approved by:    re (cperciva)
2025-02-28 00:33:27 +01:00
Jose Luis Duran e8043c76e3 openssh: Fix blacklistd sshd-session integration
In version 9.8, the server was split into a listener binary, sshd(8),
and a per-session binary "sshd-session".

Our blacklistd changes also have to be moved from sshd.c to
sshd-session.c.

Reviewed by:	emaste
Approved by:	emaste (mentor)
Fixes:	0fdf8fae8b ("openssh: Update to 9.8p1")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D49116

(cherry picked from commit 61d8af38bf)
(cherry picked from commit 707ac59c2b)
(cherry picked from commit f931a32bca)

Approved by:	re (cperciva)
2025-02-26 17:16:16 +00:00
Colin Percival 93b7f9301c pkg-stage.sh: Remove kde entirely
The package set for FreeBSD 13.5 comes from the 2025Q1 branch, which
doesn't have the new x11/kde (aka KDE 6) port; but shipping x11/kde5
(which is still in the 2025Q1 branch) doesn't make much sense either
since a few weeks after the release that will no longer be available
in either "latest" or "quarterly" package sets.

Just remove KDE packages from the 13.5 DVD entirely; this also makes
the DVD image fit into 4.7 GB size limit of physical DVDs again.

Direct commit to releng/13.5.

With hat:	re
Approved by:	re (cperciva)
Fixes:	ee6c7bf50b ("pkg-stage.sh: kde5 -> kde")
Sponsored by:	Amazon
2025-02-21 08:18:19 -08:00
Colin Percival 7f6d09003a 13.5: Update to BETA3
Approved by:	re (implicit)
Sponsored by:	Amazon
2025-02-20 16:05:22 -08:00
Colin Percival ee6c7bf50b pkg-stage.sh: kde5 -> kde
The "kde5" package no longer exists; KDE goes to 6.

Note: Depending on the size of 13.5-BETA3 DVD images, KDE might end
up being removed from this list in the near future.

With hat:	re@
Approved by:	re (cperciva)
MFC after:	30 seconds
Sponsored by:	Amazon

(cherry picked from commit 0d7b98c06c)
(cherry picked from commit 4ddbb7945c)
2025-02-20 16:05:11 -08:00
Ed Maste 31dcdee20a openssh: Update to 9.9p2
This release exists primarily to fix two security bugs.  The fixes have
been independently imported into FreeBSD.  This import serves to update
the ssh and sshd version number.

A few minor bug fixes are also included; see the upstream release notes
for full details of the 9.9p2 release
(https://www.openssh.com/releasenotes.html).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0ae642c7dd)

Approved by:	re (accelerated MFC)

(cherry picked from commit 059b786b7d)
(cherry picked from commit a8c1ea2614)

Approved by:	re (cperciva)
2025-02-20 13:45:48 -05:00
Ed Maste cb8e164fbb openssh: Update to 9.9p1
Highlights from the release notes are reproduced below.  Bug fixes and
improvements that were previously merged into FreeBSD have been elided.

See the upstream release notes for full details of the 9.9p1 release
(https://www.openssh.com/releasenotes.html).

---

Future deprecation notice
=========================

OpenSSH plans to remove support for the DSA signature algorithm in
early 2025.

Potentially-incompatible changes
--------------------------------

 * ssh(1): remove support for pre-authentication compression.

 * ssh(1), sshd(8): processing of the arguments to the "Match"
   configuration directive now follows more shell-like rules for
   quoted strings, including allowing nested quotes and \-escaped
   characters.

New features
------------

 * ssh(1), sshd(8): add support for a new hybrid post-quantum key
   exchange based on the FIPS 203 Module-Lattice Key Enapsulation
   mechanism (ML-KEM) combined with X25519 ECDH as described by
   https://datatracker.ietf.org/doc/html/draft-kampanakis-curdle-ssh-pq-ke-03
   This algorithm "mlkem768x25519-sha256" is available by default.

 * ssh(1), sshd(8), ssh-agent(1): prevent private keys from being
   included in core dump files for most of their lifespans. This is
   in addition to pre-existing controls in ssh-agent(1) and sshd(8)
   that prevented coredumps. This feature is supported on OpenBSD,
   Linux and FreeBSD.

 * All: convert key handling to use the libcrypto EVP_PKEY API, with
   the exception of DSA.

Bugfixes
--------

 * sshd(8): do not apply authorized_keys options when signature
   verification fails. Prevents more restrictive key options being
   incorrectly applied to subsequent keys in authorized_keys. bz3733

 * ssh-keygen(1): include pathname in some of ssh-keygen's passphrase
   prompts. Helps the user know what's going on when ssh-keygen is
   invoked via other tools. Requested in GHPR503

 * ssh(1), ssh-add(1): make parsing user@host consistently look for
   the last '@' in the string rather than the first. This makes it
   possible to more consistently use usernames that contain '@'
   characters.

 * ssh(1), sshd(8): be more strict in parsing key type names. Only
   allow short names (e.g "rsa") in user-interface code and require
   full SSH protocol names (e.g. "ssh-rsa") everywhere else. bz3725

 * ssh-keygen(1): clarify that ed25519 is the default key type
   generated and clarify that rsa-sha2-512 is the default signature
   scheme when RSA is in use. GHPR505

---

Reviewed by:	jlduran (build infrastructure)
Reviewed by:	cy (build infrastructure)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48947

(cherry picked from commit 3d9fd9fcb4)

Approved by:	re (accelerated MFC)

(cherry picked from commit 802386cd37)
(cherry picked from commit 6e688e6d4f)

Approved by:	re (cperciva)
2025-02-20 13:45:36 -05:00
Ed Maste b74bb7f011 openssh: Update to 9.8p1
Highlights from the release notes are reproduced below.  Some security
and bug fixes were previously merged into FreeBSD and have been elided.
See the upstream release notes for full details
(https://www.openssh.com/releasenotes.html).

---

Future deprecation notice
=========================

OpenSSH plans to remove support for the DSA signature algorithm in
early 2025.

Potentially-incompatible changes
--------------------------------

 * sshd(8): the server will now block client addresses that
   repeatedly fail authentication, repeatedly connect without ever
   completing authentication or that crash the server. See the
   discussion of PerSourcePenalties below for more information.
   Operators of servers that accept connections from many users, or
   servers that accept connections from addresses behind NAT or
   proxies may need to consider these settings.

 * sshd(8): the server has been split into a listener binary, sshd(8),
   and a per-session binary "sshd-session". This allows for a much
   smaller listener binary, as it no longer needs to support the SSH
   protocol. As part of this work, support for disabling privilege
   separation (which previously required code changes to disable) and
   disabling re-execution of sshd(8) has been removed. Further
   separation of sshd-session into additional, minimal binaries is
   planned for the future.

 * sshd(8): several log messages have changed. In particular, some
   log messages will be tagged with as originating from a process
   named "sshd-session" rather than "sshd".

 * ssh-keyscan(1): this tool previously emitted comment lines
   containing the hostname and SSH protocol banner to standard error.
   This release now emits them to standard output, but adds a new
   "-q" flag to silence them altogether.

 * sshd(8): (portable OpenSSH only) sshd will no longer use argv[0]
   as the PAM service name. A new "PAMServiceName" sshd_config(5)
   directive allows selecting the service name at runtime. This
   defaults to "sshd". bz2101

New features
------------

 * sshd(8): sshd(8) will now penalise client addresses that, for various
   reasons, do not successfully complete authentication. This feature is
   controlled by a new sshd_config(5) PerSourcePenalties option and is
   on by default.

 * ssh(8): allow the HostkeyAlgorithms directive to disable the
   implicit fallback from certificate host key to plain host keys.

Portability
-----------

 * sshd(8): expose SSH_AUTH_INFO_0 always to PAM auth modules
   unconditionally. The previous behaviour was to expose it only when
   particular authentication methods were in use.

 * ssh(1), ssh-agent(8): allow the presence of the WAYLAND_DISPLAY
   environment variable to enable SSH_ASKPASS, similarly to the X11
   DISPLAY environment variable. GHPR479

---

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48914

(cherry picked from commit 0fdf8fae8b)
(cherry picked from commit b4bb480ae9)
(cherry picked from commit e95979047a)
(cherry picked from commit dcb4ae528d)

Approved by:	re (accelerated MFC)

(cherry picked from commit ff2fd01609)
(cherry picked from commit c845ae4755)

Approved by:	re (cperciva)
2025-02-20 13:45:19 -05:00
Ed Maste d2b7937c2c ssh_config.5: Remove redundant CheckHostIP default text
In 2000 (commit a95c122521) we changed the CheckHostIP default to
"no".  We added text to ssh_config(5) documenting FreeBSD's default.

In 2021 OpenSSH made the same change, released with OpenSSH 8.5p1.
When we imported the update the added text remained, resulting in:

    If the option is set to no (the default), the check will not be
    executed.  The default is no.

Remove the now-redundant text.

Fixes: 206be79acb ("Vendor import of OpenSSH 8.5p1")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 06016adacc)
(cherry picked from commit 2c97e33316)
(cherry picked from commit 935e29dcdd)

Approved by:	re (cperciva)
2025-02-20 13:45:11 -05:00
Ed Maste ef280c2e5f libssh: Remove progressmeter
It is used only by scp and sftp, and already included directly in their
Makefiles.  It does not belong in libssh.

Fixes: d8b043c8d4 ("Update for 3.6.1p1; also remove Kerberos IV shims.")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48871

(cherry picked from commit c0af329525)
(cherry picked from commit 8a02eb2c1e)
(cherry picked from commit 63d3c24522)

Approved by:	re (cperciva)
2025-02-20 13:45:03 -05:00
Ed Maste 6cb9cfffa8 ssh: Move XAUTH_PATH setting to ssh.mk
XAUTH_PATH is normally set (in the upstream build infrastructure) in
config.h.  We previously set it in ssh and sshd's Makefiles if LOCALBASE
is set, and over time have sometimes also defined it in config.h.

Leave it unset in config.h and move the CFLAGS logic to to ssh.mk so
that it will be set when building all ssh libraries and programs but
still be set by LOCALBASE.

Reviewed by:	jlduran
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48907

(cherry picked from commit a63701848f)
(cherry picked from commit 73dd56ffcd)
(cherry picked from commit 10e9add50f)

Approved by:	re (cperciva)
2025-02-20 13:44:55 -05:00
Ed Maste 78b4f77518 ssh: Bump VersionAddendum for CVE fixes
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 62df41ae0a)
(cherry picked from commit 24ce323f02)
(cherry picked from commit 2fc62d0bd4)

Approved by:	re (implicit)
2025-02-20 13:00:27 -05:00
Ed Maste 88fcdcb08a ssh: Fix cases where error codes were not correctly set
Obtained from:	OpenSSH 38df39ecf278
Security:	CVE-2025-26465
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 170059d6d3)
(cherry picked from commit 4ad8c195cf)
(cherry picked from commit 8c67967cb1)

Approved by:	re (implicit)
2025-02-20 13:00:19 -05:00
Ed Maste fb30987533 ssh: Don't reply to PING in preauth phase or during KEX
Obtained from:	OpenSSH 5e07dee272c3
Security:	CVE-2025-26466
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8a16d0831e)
(cherry picked from commit 34798cb576)
(cherry picked from commit 3ea366f744)

Approved by:	re (implicit)
2025-02-20 13:00:11 -05:00
Colin Percival 6e06a07978 13.5: Update to BETA2
Approved by:	re (implicit)
Sponsored by:	Amazon
2025-02-14 00:00:00 +00:00
Zhenlei Huang 6b0086795d sysctl: Harden sysctl_handle_string() against unterminated string
In case a variable string which is not null-terminated is passed in,
strlen() may report a length exceeding the max length, hence it is
possible to leak a portion of kernel memory to the userland.

Harden that by using strnlen() to limit the length to the max length.
While here, refactor the code a little to improve readability.

Note that, when calculating the out length, the null terminator '\0' of
the string is taken into account if available. This is not really
necessary but userland applications may have already relied on this
behavior.

Reviewed by:	avg, kib, olce
Approved by:	re (cperciva)
Fixes:		210176ad76 sysctl(9): add CTLFLAG_NEEDGIANT flag
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D48881

(cherry picked from commit 1951235537)
(cherry picked from commit 8ca77f9f9e)
(cherry picked from commit dcd7286d90)
2025-02-14 00:52:50 +08:00
Zhenlei Huang 3afa8f08bc MAC: mac_biba, mac_lomac: Fix setting loader tunables
A string loader tunable requires setting the len parameter to a nonzero
value, typically the size of the string, to have the flag CTLFLAG_TUN
work correctly [1] [2].

Without this fix security.mac.{biba,lomac}.trusted_interfaces would
have no effect at all.

[1] 3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically ...
[2] 6a3287f889 Fix regression issue after r267961. Handle special string case ...

Reviewed by:	olce, kib
Approved by:	re (cperciva)
Fixes:		af3b2549c4 Pull in r267961 and r267973 again ...
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D48898

(cherry picked from commit 7d4c0fac8c)
(cherry picked from commit 04f360b782)
(cherry picked from commit 87836ab994)
2025-02-14 00:52:50 +08:00
Michael Tuexen cd91df3292 icmp: use per rate limit randomized jitter
Using the same random jitter for multiple rate limits allows an
attacker to use one rate limiter to figure out the current jitter
and then use this knowledge to de-randomize the other rate limiters.
This can be mitigated by using a separate randomized jitter for each
rate limiter.
This issue was reported as issue number 10 in Keyu Man et al.:
SCAD: Towards a Universal and Automated Network Side-Channel
Vulnerability Detection

Reviewed by:		rrs, Peter Lei, glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48804
Approved by:		re (cperciva)

(cherry picked from commit 923c223f27)
(cherry picked from commit e1dd07ede9)
2025-02-13 15:04:39 +01:00
Michael Tuexen 5f2744d520 icmp: improve INVARIANTS check
Actually check the conditions that are enforced by the error checking
code instead of a condition which is
* checking a number to be non-negative instead of positive
* depending on a random number
Perform the checks consistently for ICMPv4 and ICMPv6.

Reviewed by:		glebius, rrs, cc
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48001
Approved by:		re (cperciva)

(cherry picked from commit c9febea3dc)
(cherry picked from commit bd6a89a6c3)
2025-02-13 15:03:55 +01:00
Gleb Smirnoff a3b66c4bf0 icmp: correct the assertion that checks limit + jitter
Fixes:	4399e055ea
Approved by:	re (cperciva)

(cherry picked from commit f7c4d12bcd)
(cherry picked from commit 1b4561cf4b)
2025-02-13 15:03:13 +01:00
Gleb Smirnoff 881ba70c1a icmp: allow zero value for ICMP limits
Zero means limit is disabled, so the value doesn't need to be checked
against jitter value.

Fixes:	ac44739fd8
Fixes:	a03aff88a1
Approved by:	re (cperciva)

(cherry picked from commit 4399e055ea)
(cherry picked from commit 0b29ef1e3f)
2025-02-13 15:02:12 +01:00
Gleb Smirnoff ebda0be762 icmp6: bring rate limiting on a par with IPv4
Use counter_ratecheck() instead of racy and slow ppsratecheck. Use a
separate counter for every currently known type of ICMPv6. Provide logging
of ratelimit events. Provide jitter to counter open UDP port detection.

With minor tweaks from tuexen@ to fix merge problems.

Reviewed by:		tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44482
Approved by:		re (cperciva)

(cherry picked from commit a03aff88a1)
(cherry picked from commit 1cc0ac5ef3)
2025-02-13 15:01:36 +01:00
Gleb Smirnoff a7ad643719 icmp6: rate limit our echo replies
The generation of ICMP6_ECHO_REPLY bypasses icmp6_error(), thus rate
limit was not applied.

Reviewed by:		tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44480
Approved by:		re (cperciva)

(cherry picked from commit 32aeee8ce7)
(cherry picked from commit 90ecc3fc67)
2025-02-13 15:00:57 +01:00
Gleb Smirnoff 9880ce0765 icmp6: make icmp6_ratelimit() responsible to update the stats counter
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D44479
Approved by:		re (cperciva)

(cherry picked from commit c6c96aaba8)
(cherry picked from commit dc167e64dc)
2025-02-13 15:00:23 +01:00
Gleb Smirnoff 1ed60133f6 icmp: improve ICMP limit jitter
Instead of fixing up invalid values set by a user in badport_bandlim()
which is a fast path function, provide a sysctl handler
sysctl_icmplim_and_jitter(), that will check that jitter is less than the
limit.

Provide jitter initilization function icmplim_new_jitter() used at boot,
in the sysctl handler and when we actually hit the limit.  This also fixes
no jitter on a fresh booted system until first limit hit.

Instead of CVE number provide link the the actual paper that explains what
and why we are doing here.  The CVE number isn't very informative, it will
just tell you what RedHat version you need to upgrade to.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44478
Approved by:		re (cperciva)

(cherry picked from commit ac44739fd8)
(cherry picked from commit 18058544c6)
2025-02-13 14:59:46 +01:00
Gleb Smirnoff b6dc660155 icmp: when logging ICMP ratelimiting message use correct jitter value
The limiting of the very last second has been done using certain jitter
value.  We update the jitter for the next second.  But the logging should
report the jitter before the change.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44477
Approved by:		re (cperciva)

(cherry picked from commit b508545ce0)
(cherry picked from commit a71eee300b)
2025-02-13 14:59:09 +01:00
Gleb Smirnoff a0146592cd icmp: hide icmp_bandlimit_uninit() under VIMAGE
The uninitialization may be executed only on a kernel with VIMAGE.

Reviewed by:		kp, tuexen, zlei
Differential Revision:	https://reviews.freebsd.org/D44476
Approved by:		re (cperciva)

(cherry picked from commit 9d7f17d746)
(cherry picked from commit a6d5c6a04f)
2025-02-13 14:57:18 +01:00
Gleb Smirnoff ebc96321e7 icmp: do not store per-VNET identical array of strings
We need per-VNET struct counter_rate, but we don't need per-VNET set of
const char *.  Also, identical word "response" can go into the format
string instead of being stored 7 times.

Reviewed by:		kp, zlei, tuexen
Differential Revision:	https://reviews.freebsd.org/D44475
Approved by:		re (cperciva)

(cherry picked from commit 7142ab4790)
(cherry picked from commit 0939f3a046)
2025-02-13 14:56:10 +01:00
Ronald Klop e375421e24 Remove obsolete clang18 files for aarch64
This fixes a warning from "make delete-old" about a non-empty directory
on aarch64.

Reviewed by:	dim
Approved by:	re (cperciva)
Fixes:		0fca6ea1d4
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D48904

(cherry picked from commit 09b435d3dc)
(cherry picked from commit 9370c2c331)
2025-02-13 16:59:36 +01:00
Dag-Erling Smørgrav 1aaec1978a unifdef: Fix collision check when adding symbols.
findsym() is intended for use while parsing input, so it should not be
called from addsym2() or indirectsym(), which are called before any
input is processed.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D48733
Approved by:	re (cperciva)

(cherry picked from commit c63af363c2)
(cherry picked from commit 931b099029)
2025-02-13 16:12:02 +01:00
Kirk McKusick dfe803fdbc Defer the January 19, 2038 date limit in UFS1 filesystems to February 7, 2106
Standardize the definition of a UFS dinode.

Differential Revision: https://reviews.freebsd.org/D48472

(cherry picked from commit 1111a44301)
(cherry picked from commit aa90fbed15)
(cherry picked from commit 256389eaf1)
(cherry picked from commit 6cd973d903)
(cherry picked from commit e1ebda4458)
(cherry picked from commit 6f87402a02)

Approved-by: re (cperciva)
2025-02-09 23:38:51 -08:00
Colin Percival ef6b3c5888 release: Chase location of pkg repo databases
pkg used to store copies of upstream repository databases in
/var/db/pkg/repo-*.sqlite.  About a year ago this was moved to
/var/db/pkg/repos/*/, resulting in FreeBSD cloud images no longer
having those (unhelpful since they'll be long out of date before
the cloud images are launched) databases removed.

Remove the correct location, and hope that future pkg updates don't
break the base system again.

Sponsored by:	Amazon
Approved by:	re (cperciva)

(cherry picked from commit 078e8b34b1)
(cherry picked from commit 8984d070d6)
2025-02-09 13:18:40 -08:00
Colin Percival a8f9845e39 13.5: create releng/13.5 branch
Update from PRERELEASE to BETA1
Switch pkg(8) configuration to use the quarterly repository
Bump __FreeBSD_version

Approved by:	re (implicit)
Sponsored by:	Amazon
2025-02-07 00:00:00 +00:00
3038 changed files with 196618 additions and 270863 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ compute_engine_instance:
# gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images
platform: freebsd
image_project: freebsd-org-cloud-dev
image: freebsd-13-5-release-amd64
image: freebsd-13-3-release-amd64
cpu: 8
memory: 8G
disk: 40
+1 -1
View File
@@ -2,7 +2,7 @@ name: Cross-build Kernel
on:
push:
branches: [ main, 'stable/[1-9][0-9]' ]
branches: [ main, 'stable/13' ]
pull_request:
branches: [ main ]
-1
View File
@@ -22,4 +22,3 @@ cscope.in.out
cscope.out
cscope.po.out
tags
/src.conf
+3 -8
View File
@@ -607,10 +607,7 @@ XPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin
# When building we want to find the cross tools before the host tools in ${BPATH}.
# We also need to add UNIVERSE_TOOLCHAIN_PATH so that we can find the shared
# toolchain files (clang, lld, etc.) during make universe/tinderbox
STRICTTMPPATH= ${XPATH}:${BPATH}
.if defined(UNIVERSE_TOOLCHAIN_PATH)
STRICTTMPPATH:=${STRICTTMPPATH}:${UNIVERSE_TOOLCHAIN_PATH}
.endif
STRICTTMPPATH= ${XPATH}:${BPATH}:${UNIVERSE_TOOLCHAIN_PATH}
# We should not be using tools from /usr/bin accidentally since this could cause
# the build to break on other systems that don't have that tool. For now we
# still allow using the old behaviour (inheriting $PATH) if
@@ -785,7 +782,6 @@ TMAKE= \
# TOOLS_PREFIX set in BMAKE
XMAKE= ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
MK_CLANG=${MK_CLANG_BOOTSTRAP} \
MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \
MK_LLDB=no \
MK_LLVM_BINUTILS=no \
@@ -1358,7 +1354,7 @@ _sysctl=sysctl
.endif
ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
date echo egrep find grep id install \
date echo egrep find grep id install ${_install-info} \
ln make mkdir mtree mv pwd_mkdb \
rm sed services_mkdb sh sort strip ${_sysctl} test true uname wc
@@ -2711,7 +2707,7 @@ _elftctools= lib/libelftc \
.endif
.if ${MK_CLANG_BOOTSTRAP} != "no"
_clang= usr.bin/clang/clang
_clang= usr.bin/clang
.endif
.if ${MK_LLD_BOOTSTRAP} != "no"
_lld= usr.bin/clang/lld
@@ -2850,7 +2846,6 @@ NXBMAKEARGS+= \
MK_DEBUG_FILES=no \
MK_HTML=no \
MK_LLDB=no \
MK_LLVM_LINK_STATIC_LIBRARIES=yes \
MK_MAN=no \
MK_MAN_UTILS=yes \
MK_OFED=no \
-133
View File
@@ -51,123 +51,6 @@
# xargs -n1 | sort | uniq -d;
# done
# 20260430: Regenerate trust store
OLD_FILES+=usr/share/certs/trusted/Entrust_net_Premium_2048_Secure_Server_CA.pem
OLD_FILES+=usr/share/certs/trusted/AffirmTrust_Premium.pem
OLD_FILES+=usr/share/certs/trusted/Starfield_Class_2_CA.pem
OLD_FILES+=usr/share/certs/trusted/GTS_Root_R2.pem
OLD_FILES+=usr/share/certs/trusted/GLOBALTRUST_2020.pem
OLD_FILES+=usr/share/certs/trusted/Secure_Global_CA.pem
OLD_FILES+=usr/share/certs/trusted/GlobalSign_Root_CA.pem
OLD_FILES+=usr/share/certs/trusted/CommScope_Public_Trust_RSA_Root-01.pem
OLD_FILES+=usr/share/certs/trusted/Trustwave_Global_ECC_P384_Certification_Authority.pem
OLD_FILES+=usr/share/certs/trusted/SwissSign_Gold_CA_-_G2.pem
OLD_FILES+=usr/share/certs/trusted/Go_Daddy_Class_2_CA.pem
OLD_FILES+=usr/share/certs/trusted/FIRMAPROFESIONAL_CA_ROOT-A_WEB.pem
OLD_FILES+=usr/share/certs/trusted/Trustwave_Global_Certification_Authority.pem
OLD_FILES+=usr/share/certs/trusted/Trustwave_Global_ECC_P256_Certification_Authority.pem
OLD_FILES+=usr/share/certs/trusted/CommScope_Public_Trust_ECC_Root-01.pem
OLD_FILES+=usr/share/certs/trusted/Entrust_Root_Certification_Authority_-_EC1.pem
OLD_FILES+=usr/share/certs/trusted/Certigna.pem
OLD_FILES+=usr/share/certs/trusted/AffirmTrust_Commercial.pem
OLD_FILES+=usr/share/certs/trusted/DigiCert_Assured_ID_Root_CA.pem
OLD_FILES+=usr/share/certs/trusted/Baltimore_CyberTrust_Root.pem
OLD_FILES+=usr/share/certs/trusted/CommScope_Public_Trust_ECC_Root-02.pem
OLD_FILES+=usr/share/certs/trusted/Entrust_Root_Certification_Authority.pem
OLD_FILES+=usr/share/certs/trusted/AffirmTrust_Premium_ECC.pem
OLD_FILES+=usr/share/certs/trusted/CommScope_Public_Trust_RSA_Root-02.pem
OLD_FILES+=usr/share/certs/trusted/TeliaSonera_Root_CA_v1.pem
OLD_FILES+=usr/share/certs/trusted/QuoVadis_Root_CA_2.pem
OLD_FILES+=usr/share/certs/trusted/COMODO_Certification_Authority.pem
OLD_FILES+=usr/share/certs/trusted/SecureTrust_CA.pem
OLD_FILES+=usr/share/certs/trusted/Comodo_AAA_Services_root.pem
OLD_FILES+=usr/share/certs/trusted/Entrust_Root_Certification_Authority_-_G2.pem
OLD_FILES+=usr/share/certs/trusted/QuoVadis_Root_CA_3.pem
OLD_FILES+=usr/share/certs/trusted/DigiCert_High_Assurance_EV_Root_CA.pem
OLD_FILES+=usr/share/certs/trusted/certSIGN_ROOT_CA.pem
OLD_FILES+=usr/share/certs/trusted/DigiCert_Global_Root_CA.pem
OLD_FILES+=usr/share/certs/trusted/AffirmTrust_Networking.pem
OLD_FILES+=usr/share/certs/trusted/XRamp_Global_CA_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/Security_Communication_RootCA3.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem
OLD_FILES+=usr/share/certs/blacklisted/E-Tugra_Global_Root_CA_ECC_v3.pem
OLD_FILES+=usr/share/certs/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G4.pem
OLD_FILES+=usr/share/certs/blacklisted/EE_Certification_Centre_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/EC-ACC.pem
OLD_FILES+=usr/share/certs/blacklisted/Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Universal_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/Global_Chambersign_Root_-_2008.pem
OLD_FILES+=usr/share/certs/blacklisted/Camerfirma_Global_Chambersign_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem
OLD_FILES+=usr/share/certs/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/TrustCor_RootCert_CA-2.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Universal_CA_2.pem
OLD_FILES+=usr/share/certs/blacklisted/Network_Solutions_Certificate_Authority.pem
OLD_FILES+=usr/share/certs/blacklisted/thawte_Primary_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/E-Tugra_Global_Root_CA_RSA_v3.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Primary_Certification_Authority.pem
OLD_FILES+=usr/share/certs/blacklisted/Taiwan_GRCA.pem
OLD_FILES+=usr/share/certs/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem
OLD_FILES+=usr/share/certs/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem
OLD_FILES+=usr/share/certs/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
OLD_FILES+=usr/share/certs/blacklisted/SwissSign_Platinum_CA_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/TrustCor_RootCert_CA-1.pem
OLD_FILES+=usr/share/certs/blacklisted/thawte_Primary_Root_CA_-_G3.pem
OLD_FILES+=usr/share/certs/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/SwissSign_Silver_CA_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/TrustCor_ECA-1.pem
OLD_FILES+=usr/share/certs/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
OLD_FILES+=usr/share/certs/blacklisted/SecureSign_RootCA11.pem
OLD_FILES+=usr/share/certs/blacklisted/Chambers_of_Commerce_Root_-_2008.pem
OLD_FILES+=usr/share/certs/blacklisted/Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
OLD_FILES+=usr/share/certs/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem
OLD_FILES+=usr/share/certs/blacklisted/LuxTrust_Global_Root_2.pem
OLD_FILES+=usr/share/certs/blacklisted/thawte_Primary_Root_CA_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G4.pem
# 20251006: Remove libnss_tacplus.a (it never should have been installed)
OLD_FILES+=usr/lib/libnss_tacplus.a
# 20250812: Remove a bogus manlink
OLD_FILES+=usr/share/man/man3/quota_statfs.3.gz
# 20250805: Test case renamed
OLD_FILES+=usr/tests/usr.bin/xargs/regress.n2147483647.out
# 20250710: share: Delete bitrotted make_*_driver.sh scripts
OLD_FILES+=usr/share/examples/drivers/README
OLD_FILES+=usr/share/examples/drivers/make_device_driver.sh
OLD_FILES+=usr/share/examples/drivers/make_pseudo_driver.sh
OLD_DIRS+=usr/share/examples/drivers
# 20250524: don't install zoneinfo version
OLD_FILES+=usr/share/zoneinfo/version
# 20250310: caroot bundle updated
OLD_FILES+=usr/share/certs/trusted/Entrust_Root_Certification_Authority_-_G4.pem
OLD_FILES+=usr/share/certs/trusted/SecureSign_RootCA11.pem
OLD_FILES+=usr/share/certs/trusted/Security_Communication_RootCA3.pem
OLD_FILES+=usr/share/certs/trusted/SwissSign_Silver_CA_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/AddTrust_External_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/AddTrust_Low-Value_Services_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/Staat_der_Nederlanden_Root_CA_-_G2.pem
OLD_FILES+=usr/share/certs/blacklisted/Cybertrust_Global_Root.pem
OLD_FILES+=usr/share/certs/blacklisted/DST_Root_CA_X3.pem
OLD_FILES+=usr/share/certs/blacklisted/GlobalSign_Root_CA_-_R2.pem
OLD_FILES+=usr/share/certs/blacklisted/QuoVadis_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/Sonera_Class_2_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/GeoTrust_Global_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/Staat_der_Nederlanden_EV_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/E-Tugra_Certification_Authority.pem
OLD_FILES+=usr/share/certs/blacklisted/Hongkong_Post_Root_CA_1.pem
OLD_FILES+=usr/share/certs/blacklisted/Security_Communication_Root_CA.pem
OLD_FILES+=usr/share/certs/blacklisted/Trustis_FPS_Root_CA.pem
# 20250204: sys/vm/stack test symbols moved to /usr/lib/debug
OLD_FILES+=usr/tests/sys/vm/stack/.debug/libsoxstack.so.debug
OLD_DIRS+=usr/tests/sys/vm/stack/.debug
# 20241201: new clang import which bumps version from 18 to 19
OLD_FILES+=usr/lib/clang/18/include/__clang_cuda_builtin_vars.h
OLD_FILES+=usr/lib/clang/18/include/__clang_cuda_cmath.h
@@ -1512,22 +1395,6 @@ OLD_FILES+=usr/share/certs/trusted/E-Tugra_Global_Root_CA_ECC_v3.pem
OLD_FILES+=usr/share/certs/trusted/E-Tugra_Global_Root_CA_RSA_v3.pem
OLD_FILES+=usr/share/certs/trusted/Hongkong_Post_Root_CA_1.pem
# 20230807: GoogleTest 1.14.0 upgrade.
OLD_FILES+=usr/include/private/gmock/gmock-generated-actions.h
OLD_FILES+=usr/include/private/gmock/gmock-generated-function-mockers.h
OLD_FILES+=usr/include/private/gmock/gmock-generated-matchers.h
OLD_FILES+=usr/include/private/gmock/gmock-generated-nice-strict.h
OLD_FILES+=usr/include/private/gmock/internal/gmock-generated-internal-utils.h
OLD_FILES+=usr/include/private/gtest/internal/gtest-linked_ptr.h
OLD_FILES+=usr/include/private/gtest/internal/gtest-param-util-generated.h
OLD_FILES+=usr/include/private/gtest/internal/gtest-tuple.h
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-actions_test
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-function-mockers_test
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-internal-utils_test
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-matchers_test
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers_test
OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test
# 20230806: Removal of support for the VTOC8 partitioning scheme
OLD_FILES+=usr/include/sys/disk/vtoc.h
OLD_FILES+=usr/include/sys/vtoc.h
+3 -5
View File
@@ -12,16 +12,14 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before updating system packages
and/or ports.
20250311:
13.5-RELEASE.
20250117:
The layout of NFS file handles for the cd9660 and ext2fs file systems
has changed. An NFS server that exports any of these file systems will
need its clients to unmount and remount the exports.
20250916:
If SRCCONF is unset and a file named src.conf is present at
the top of the source tree, it will now be used instead of
/etc/src.conf.
20240419:
Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have
been upgraded to 18.1.6. It is important that you run `make delete-old`
+9 -9
View File
@@ -227,7 +227,7 @@ main(int argc, char *argv[])
* Case (1). Target is not a directory.
*/
if (argc > 1)
errc(1, ENOTDIR, "%s", to.p_path);
errx(1, "%s is not a directory", to.p_path);
/*
* Need to detect the case:
@@ -250,17 +250,17 @@ main(int argc, char *argv[])
type = FILE_TO_FILE;
if (have_trailing_slash && type == FILE_TO_FILE) {
if (r == -1)
errc(1, ENOENT, "%s", to.p_path);
else
errc(1, ENOTDIR, "%s", to.p_path);
if (r == -1) {
errx(1, "directory %s does not exist",
to.p_path);
} else
errx(1, "%s is not a directory", to.p_path);
}
} else {
} else
/*
* Case (2). Target is a directory.
*/
type = FILE_TO_DIR;
}
/*
* For DIR_TO_DNE, we could provide copy() with the to_stat we've
@@ -368,8 +368,8 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
base = (p == NULL) ? 0 :
(int)(p - curr->fts_path + 1);
if (strcmp(curr->fts_path + base, "..")
== 0)
if (!strcmp(&curr->fts_path[base],
".."))
base += 1;
} else
base = curr->fts_pathlen;
+4 -4
View File
@@ -74,7 +74,7 @@ hardlink_body()
echo "foo" >foo
atf_check cp -l foo bar
atf_check -o inline:"foo\n" cat bar
atf_check test foo -ef bar
atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
}
atf_test_case hardlink_exists
@@ -84,7 +84,7 @@ hardlink_exists_body()
echo "bar" >bar
atf_check -s not-exit:0 -e match:exists cp -l foo bar
atf_check -o inline:"bar\n" cat bar
atf_check test ! foo -ef bar
atf_check_not_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
}
atf_test_case hardlink_exists_force
@@ -94,7 +94,7 @@ hardlink_exists_force_body()
echo "bar" >bar
atf_check cp -fl foo bar
atf_check -o inline:"foo\n" cat bar
atf_check test foo -ef bar
atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
}
atf_test_case matching_srctgt
@@ -247,7 +247,7 @@ file_is_sparse()
files_are_equal()
{
atf_check test ! "$1" -ef "$2"
atf_check_not_equal "$(stat -f%d,%i "$1")" "$(stat -f%d,%i "$2")"
atf_check cmp "$1" "$2"
}
+2 -5
View File
@@ -213,10 +213,7 @@ copy_file(const FTSENT *entp, int dne)
if (!use_copy_file_range) {
wcount = copy_fallback(from_fd, to_fd);
}
if (wcount >= 0)
wtotal += wcount;
else if (errno != EINTR)
break;
wtotal += wcount;
if (info) {
info = 0;
(void)fprintf(stderr,
@@ -224,7 +221,7 @@ copy_file(const FTSENT *entp, int dne)
entp->fts_path, to.p_path,
cp_pct(wtotal, fs->st_size));
}
} while (wcount != 0);
} while (wcount > 0);
if (wcount < 0) {
warn("%s", entp->fts_path);
rval = 1;
+4 -4
View File
@@ -31,7 +31,7 @@
.\"
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\"
.Dd September 1, 2025
.Dd February 27, 2023
.Dt DATE 1
.Os
.Sh NAME
@@ -128,7 +128,7 @@ format.
Parsing is done using
.Xr strptime 3 .
.It Fl I Ns Op Ar FMT
Use extended
Use
.St -iso8601
output format.
.Ar FMT
@@ -151,9 +151,9 @@ is
.Cm minutes
or
.Cm seconds ) ,
the extended
the
.St -iso8601
format includes the timezone offset.
format includes the timezone.
.It Fl j
Do not try to set the date.
This allows you to use the
+1 -1
View File
@@ -28,7 +28,7 @@
atf_check_same_file()
{
atf_check test "$1" -ef "$2"
atf_check_equal "$(stat -f %d,%i "$1")" "$(stat -f %d,%i "$2")"
}
atf_check_symlink_to()
+2 -7
View File
@@ -579,7 +579,6 @@ waitcmdloop(struct job *job)
freejob(job);
else {
job->remembered = 0;
deljob(job);
if (job == bgjob)
bgjob = NULL;
}
@@ -604,7 +603,7 @@ waitcmdloop(struct job *job)
break;
}
}
} while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, job) != -1);
} while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1);
sig = pendingsig_waitcmd;
pendingsig_waitcmd = 0;
@@ -1082,7 +1081,6 @@ waitforjob(struct job *jp, int *signaled)
#if JOBS
int propagate_int = jp->jobctl && jp->foreground;
#endif
int jobindex;
int status;
int st;
@@ -1090,11 +1088,8 @@ waitforjob(struct job *jp, int *signaled)
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
DOWAIT_SIG_TRAP : 0), jp) == -1) {
jobindex = jp - jobtab;
DOWAIT_SIG_TRAP : 0), jp) == -1)
dotrap();
jp = jobtab + jobindex;
}
#if JOBS
if (jp->jobctl) {
if (ttyfd >= 0 && tcsetpgrp(ttyfd, rootpid) < 0)
+1 -1
View File
@@ -75,7 +75,7 @@ extern char optval[NOPTS];
extern const char optletter[NSHORTOPTS];
#ifdef DEFINE_OPTIONS
char optval[NOPTS];
const char optletter[NSHORTOPTS] __nonstring = "efIimnsxvVECabupTPh";
const char optletter[NSHORTOPTS] = "efIimnsxvVECabupTPh";
static const unsigned char optname[] =
"\007errexit"
"\006noglob"
+6 -4
View File
@@ -33,7 +33,7 @@
.\"
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\"
.Dd March 8, 2025
.Dd November 20, 2024
.Dt SH 1
.Os
.Sh NAME
@@ -240,9 +240,11 @@ If a shell function is executed and its exit status is explicitly
tested, all commands of the function are considered to be tested as
well.
.Pp
Note that many commands return non-zero values to convey information other
than errors, which can cause unexpected program termination with
.Fl e .
It is recommended to check for failures explicitly
instead of relying on
.Fl e
because it tends to behave in unexpected ways,
particularly in larger scripts.
.It Fl f Li noglob
Disable pathname expansion.
.It Fl h Li trackall
-1
View File
@@ -186,6 +186,5 @@ ${PACKAGE}FILES+= wait7.0
${PACKAGE}FILES+= wait8.0
${PACKAGE}FILES+= wait9.127
${PACKAGE}FILES+= wait10.0
${PACKAGE}FILES+= wait11.0
.include <bsd.test.mk>
-6
View File
@@ -1,6 +0,0 @@
sleep 3 | sleep 2 &
sleep 3 &
kill %1
wait %1
r=$?
[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = TERM ]
-1
View File
@@ -19,7 +19,6 @@ ${PACKAGE}FILES+= bg10.0 bg10.0.stdout
${PACKAGE}FILES+= bg11.0
${PACKAGE}FILES+= bg12.0
${PACKAGE}FILES+= bg13.0
${PACKAGE}FILES+= bg14.0
${PACKAGE}FILES+= env1.0
${PACKAGE}FILES+= fork1.0
${PACKAGE}FILES+= fork2.0
-9
View File
@@ -1,9 +0,0 @@
T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
trap 'rm -rf "$T"' 0
cd "$T" || exit 3
mkfifo fifo1 || exit 3
set -T
trap "for i in 1 2 3 4; do sleep 1 & done" USR1
sleep 1 &
{ kill -USR1 "$$"; echo .; } >fifo1 &
(read dummy <fifo1)
+1 -1
View File
@@ -117,7 +117,7 @@ enum token {
#define TOKEN_TYPE(token) ((token) & 0xff00)
static const struct t_op {
char op_text[2] __nonstring;
char op_text[2];
short op_num;
} ops1[] = {
{"=", STREQ},
+7 -99
View File
@@ -18,9 +18,7 @@
.\" CDDL HEADER END
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd November 8, 2025
.Dd September 7, 2021
.Dt DTRACE 1
.Os
.Sh NAME
@@ -517,18 +515,7 @@ option is not specified,
.Nm
does not permit the compilation or enabling of a D program that contains
destructive actions.
.Pp
Set the
.Va security.bsd.allow_destructive_dtrace
.Xr loader 8
tunable
to
.Ql 0
to disallow the possibility of enabling destructive actions system-wide at any point at all.
Any attempts to enable destructive actions will cause
.Nm
to exit with a runtime error.
.It Fl x Ar arg Ns Op = Ns Ar value
.It Fl x Ar arg Op Ns = Ns value
Enable or modify a DTrace runtime option or D compiler option.
Boolean options are enabled by specifying their name.
Options with values are set by separating the option name and value with an
@@ -608,52 +595,6 @@ Same as the
flag.
.It Sy dynvarsize Ns = Ns Ar size
Size of the dynamic variable space.
.Sm off
.It Sy evaltime = Cm exec | preinit | postinit | main
.Sm on
Process create mode.
When using
.Fl c Ar cmd
to start a command,
.Nm
will first stop the newly started
.Ar cmd ,
evaluate the
.Xr d 7
program,
and then resume the
.Ar cmd .
The
.Cm evaltime
option controls the exact moment when this happens.
.Pp
The following table describes supported modes.
.Bl -column -offset indent "postinit" "D Program Evaluation Time"
.It Sy Mode Ta Sy D Program Evaluation Time
.It Cm exec Ta
Right at the first instruction of the command
.Ar cmd
execution.
.It Cm preinit Ta
Before
.Xr elf 5 Ap s
.Dq .init
sections.
.It Cm postinit Ta
After
.Xr elf 5 Ap s
.Dq .init
sections.
Default on
.Fx .
.It Cm main Ta
Before the first instruction of the
.Fn main
function.
.El
.Pp
Usually, there is no reason to change the default mode,
but it might be handy in situations such as shared library tracing.
.It Sy flowindent
Turn on flow indentation.
Same as the
@@ -836,14 +777,6 @@ command line to define a set of macro variables and so forth).
The additional arguments can be used in D programs specified using the
.Fl s
option or on the command line.
.Sh ENVIRONMENT
.Bl -tag -width 'DTRACE_DEBUG'
.It Ev DTRACE_DEBUG
When defined,
.Nm
will output debug log messages to
.Xr stderr 4 .
.El
.Sh FILES
.Bl -tag -width /boot/dtrace.dof -compact
.It Pa /boot/dtrace.dof
@@ -868,40 +801,15 @@ failed or that the specified request could not be satisfied.
.It 2
Invalid command line options or arguments were specified.
.El
.Sh DIAGNOSTICS
.Bl -diag
.It dtrace: could not enable tracing: Permission denied
This can happen when
.Nm
fails to enable destructive actions because
.Va security.bsd.allow_destructive_dtrace
is set to
.Ql 0
in
.Xr loader.conf 5 .
.El
.Sh HISTORY
The
.Nm
utility first appeared in
.Fx 7.1 .
.Sh SEE ALSO
.Xr cpp 1 ,
.Xr dtrace_audit 4 ,
.Xr dtrace_callout_execute 4 ,
.Xr dtrace_fbt 4 ,
.Xr dtrace_io 4 ,
.Xr dtrace_ip 4 ,
.Xr dtrace_lockstat 4 ,
.Xr dtrace_proc 4 ,
.Xr dtrace_sched 4 ,
.Xr dtrace_sctp 4 ,
.Xr dtrace_tcp 4 ,
.Xr dtrace_udp 4 ,
.Xr dtrace_udplite 4 ,
.Xr dtrace_vfs 4 ,
.Xr elf 5 ,
.Xr SDT 9
.Rs
.%T Solaris Dynamic Tracing Guide
.Re
.Sh HISTORY
The
.Nm
utility first appeared in
.Fx 7.1 .
@@ -38,6 +38,9 @@
*/
#include <pthread.h>
#ifdef illumos
#include <synch.h>
#endif
#include <stdio.h>
#include "barrier.h"
@@ -46,7 +49,12 @@ void
barrier_init(barrier_t *bar, int nthreads)
{
pthread_mutex_init(&bar->bar_lock, NULL);
pthread_cond_init(&bar->bar_cv, NULL);
#ifdef illumos
sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL);
#else
sem_init(&bar->bar_sem, 0, 0);
#endif
bar->bar_numin = 0;
bar->bar_nthr = nthreads;
}
@@ -57,14 +65,26 @@ barrier_wait(barrier_t *bar)
pthread_mutex_lock(&bar->bar_lock);
if (++bar->bar_numin < bar->bar_nthr) {
pthread_cond_wait(&bar->bar_cv, &bar->bar_lock);
pthread_mutex_unlock(&bar->bar_lock);
#ifdef illumos
sema_wait(&bar->bar_sem);
#else
sem_wait(&bar->bar_sem);
#endif
return (0);
} else {
int i;
/* reset for next use */
bar->bar_numin = 0;
pthread_cond_broadcast(&bar->bar_cv);
for (i = 1; i < bar->bar_nthr; i++)
#ifdef illumos
sema_post(&bar->bar_sem);
#else
sem_post(&bar->bar_sem);
#endif
pthread_mutex_unlock(&bar->bar_lock);
return (1);
@@ -33,7 +33,12 @@
* APIs for the barrier synchronization primitive.
*/
#include <pthread.h>
#ifdef illumos
#include <synch.h>
#else
#include <semaphore.h>
typedef sem_t sema_t;
#endif
#ifdef __cplusplus
extern "C" {
@@ -43,7 +48,7 @@ typedef struct barrier {
pthread_mutex_t bar_lock; /* protects bar_numin */
int bar_numin; /* current number of waiters */
pthread_cond_t bar_cv; /* where everyone waits */
sema_t bar_sem; /* where everyone waits */
int bar_nthr; /* # of waiters to trigger release */
} barrier_t;
+2 -2
View File
@@ -1,6 +1,6 @@
# License
Copyright (c) 2018-2025 Gavin D. Howard <gavin@gavinhoward.com>
Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -60,7 +60,7 @@ The files `src/rand.c` and `include/rand.h` are under the following copyrights
and license:
Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors<br>
Copyright (c) 2018-2025 Gavin D. Howard <gavin@gavinhoward.com>
Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
-80
View File
@@ -1,80 +0,0 @@
# Maintenance Terms
> Last Updated: 27 June 2025
The code, text, and other materials in this repository are provided as-is under
the terms of the repository's [`LICENSE.md`][0] file, as a gift to the commons
and the common good. In providing this software as-is, its author(s) admit no
further obligations from anyone using the software for any reason, particularly
with respect to:
* Releases,
* Response time,
* Change review and integration,
* Disclosure schedules,
* Discretionary, proprietary or otherwise secretive communications, and
* Any other non-contractual obligations or conventions, regardless of their
presumed urgency or severity.
Should anyone wish to make a contract with me (Gavin Howard) to ensure that work
he or she deems critical gets done, the terms are as follows:
* Compute time will be charged at \$25/hr.
* My time will be charged at \$100/hr.
* All issues deemed critical by either me or the requester, that also change the
source code (anything in `gen`, `include`, or `src`) will require at least two
weeks of fuzzing without error.
* If errors are found, those hours will still be charged on top of the final
two weeks.
* All changes will require running the [release script][2] on Linux (GCC), Linux
(Clang), FreeBSD, OpenBSD, macOS, Windows.
* Any hours spent on bugs or code that have been, or are suspected to have been,
generated by "AI" will be charged double rates.
Compute time includes, but is not limited to:
* Fuzzing.
* Running my [release script][2].
* Running tests and my [release script][2] on macOS.
My time includes, but is not limited to:
* Code review.
* Reading bug reports.
* Design.
* Coding.
* Any compute time that interferes with my ability to do any other work:
* Fuzzing makes my computer unusable, so fuzzing for the 8-12 hours of the
day that I could be working will be charged at \$100/hr.
* Same with running my [release script][2] because I run two instances on my
machine and two in VMs at the same time.
* Running my [release script][2] or any other compute time on Windows
because Windows blocks me from doing my main work on Linux.
* Any other instances of blocking compute time.
All amounts will be billed by, and paid to, [Yzena, LLC][2]. Invoices will be
provided, including line items for what each hour was spent on.
It is suggested that the following amounts be budgeted:
* At least \$3000 for a non-critical issue or change.
The release script takes about 10 hours, and I would need to run it once on
Linux (and others at the same time) and once on Windows, which is 20 hours.
Most of that won't be at the \$100/hr rate, but some probably will be. Then
an extra \$1000 for other work.
* At least \$15,000 for a critical issue or change.
The \$3000 above is the start, which leaves \$12,000. Fuzzing is expected to
cost \$11,400 (6 days a week, 8 hours a day, at \$100, the rest at \$25), and
rounded up to \$12,000 for good measure.
---
This document is inspired by [Mike Hoye's Maintenance Terms][1].
[0]: LICENSE.md
[1]: https://github.com/mhoye/maintenance-terms
[2]: scripts/release.sh
[3]: https://yzena.com/
+262 -21
View File
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -38,8 +38,6 @@ GENDIR = $(ROOTDIR)/gen
BUILDDIR = %%BUILDDIR%%
VERSION = %%VERSION%%
SRC = %%SRC%%
OBJ = %%OBJ%%
GCDA = %%GCDA%%
@@ -101,16 +99,17 @@ BC_FUZZER_C = $(BIN)/$(BC)_fuzzer_C
DC_FUZZER = $(BIN)/$(DC)_fuzzer_c
DC_FUZZER_C = $(BIN)/$(DC)_fuzzer_C
BC_TEST_OUTPUTS = tests/bc_outputs
BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3
DC_TEST_OUTPUTS = tests/dc_outputs
DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs
LIB = libbcl
LIB_NAME = $(LIB).a
LIBBC = $(BIN)/$(LIB_NAME)
BCL = bcl
GENERATE_TESTS = %%GENERATE_TESTS%%
PROBLEMATIC_TESTS = %%PROBLEMATIC_TESTS%%
BCL_TEST = $(BIN)/$(BCL)
BCL_TEST_C = $(TESTSDIR)/$(BCL).c
MANUALS = manuals
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
@@ -153,11 +152,11 @@ BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
BC_ENABLE_NLS = %%NLS%%
BC_EXCLUDE_EXTRA_MATH = %%EXCLUDE_EXTRA_MATH%%
BC_ENABLE_AFL = 0
BC_ENABLE_OSSFUZZ = 0
BC_ENABLE_MEMCHECK = 0
BC_ENABLE_AFL = %%FUZZ%%
BC_ENABLE_OSSFUZZ = %%OSSFUZZ%%
BC_ENABLE_MEMCHECK = %%MEMCHECK%%
LIB_FUZZING_ENGINE = 0
LIB_FUZZING_ENGINE = %%LIB_FUZZING_ENGINE%%
BC_DEFAULT_BANNER = %%BC_DEFAULT_BANNER%%
BC_DEFAULT_SIGINT_RESET = %%BC_DEFAULT_SIGINT_RESET%%
@@ -190,6 +189,10 @@ KARATSUBA = $(SCRIPTSDIR)/karatsuba.py
LOCALE_INSTALL = $(SCRIPTSDIR)/locale_install.sh
LOCALE_UNINSTALL = $(SCRIPTSDIR)/locale_uninstall.sh
VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
TEST_STARS = ***********************************************************************
BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
BC_DEFS0 = -DBC_DEFAULT_BANNER=$(BC_DEFAULT_BANNER)
@@ -215,7 +218,7 @@ CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
CPPFLAGS9 = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL)
CPPFLAGS = -DVERSION=$(VERSION) $(CPPFLAGS9) -DBC_ENABLE_OSSFUZZ=$(BC_ENABLE_OSSFUZZ)
CPPFLAGS = $(CPPFLAGS9) -DBC_ENABLE_OSSFUZZ=$(BC_ENABLE_OSSFUZZ)
CFLAGS = $(CPPFLAGS) $(BC_DEFS) $(DC_DEFS) %%CPPFLAGS%% %%CFLAGS%%
LDFLAGS = %%LDFLAGS%%
@@ -290,10 +293,236 @@ help:
@printf ' check alias for `make test`\n'
@printf ' clean removes all build files\n'
@printf ' clean_config removes all build files as well as the generated Makefile\n'
@printf ' clean_tests removes all build files, the generated Makefile,\n'
@printf ' and generated tests\n'
@printf ' install installs binaries to "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
@printf ' and (if enabled) manpages to "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
@printf ' karatsuba runs the karatsuba script (requires Python 3)\n'
@printf ' karatsuba_test runs the karatsuba script while running tests\n'
@printf ' (requires Python 3)\n'
@printf ' uninstall uninstalls binaries from "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
@printf ' and (if enabled) manpages from "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
@printf ' test runs the test suite\n'
@printf ' test_bc runs the bc test suite, if bc has been built\n'
@printf ' test_dc runs the dc test suite, if dc has been built\n'
@printf ' time_test runs the test suite, displaying times for some things\n'
@printf ' time_test_bc runs the bc test suite, displaying times for some things\n'
@printf ' time_test_dc runs the dc test suite, displaying times for some things\n'
@printf ' timeconst runs the test on the Linux timeconst.bc script,\n'
@printf ' if it exists and bc has been built\n'
run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests
run_all_tests_np: bc_all_tests_np timeconst_all_tests dc_all_tests_np
bc_all_tests:
%%BC_ALL_TESTS%%
bc_all_tests_np:
%%BC_ALL_TESTS_NP%%
timeconst_all_tests:
%%TIMECONST_ALL_TESTS%%
dc_all_tests:
%%DC_ALL_TESTS%%
dc_all_tests_np:
%%DC_ALL_TESTS_NP%%
history_all_tests:
%%HISTORY_TESTS%%
check: test
test: %%TESTS%%
test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_errors test_bc_stdin test_bc_read test_bc_other
@printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n'
test_bc_tests:%%BC_TESTS%%
test_bc_scripts:%%BC_SCRIPT_TESTS%%
test_bc_stdin:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/stdin.sh bc %%BC_TEST_EXEC%%
test_bc_read:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/read.sh bc %%BC_TEST_EXEC%%
test_bc_errors: test_bc_error_lines%%BC_ERROR_TESTS%%
test_bc_error_lines:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/errors.sh bc %%BC_TEST_EXEC%%
test_bc_other:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/other.sh bc $(BC_ENABLE_EXTRA_MATH) %%BC_TEST_EXEC%%
test_bc_header:
@printf '$(TEST_STARS)\n\nRunning bc tests...\n\n'
test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_errors test_dc_stdin test_dc_read test_dc_other
@printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n'
test_dc_tests:%%DC_TESTS%%
test_dc_scripts:%%DC_SCRIPT_TESTS%%
test_dc_stdin:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/stdin.sh dc %%DC_TEST_EXEC%%
test_dc_read:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/read.sh dc %%DC_TEST_EXEC%%
test_dc_errors: test_dc_error_lines%%DC_ERROR_TESTS%%
test_dc_error_lines:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/errors.sh dc %%DC_TEST_EXEC%%
test_dc_other:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/other.sh dc $(BC_ENABLE_EXTRA_MATH) %%DC_TEST_EXEC%%
test_dc_header:
@printf '$(TEST_STARS)\n\nRunning dc tests...\n\n'
timeconst:
%%TIMECONST%%
test_history: test_history_header test_bc_history test_dc_history
@printf '\nAll history tests passed.\n\n$(TEST_STARS)\n'
test_bc_history:%%BC_HISTORY_TEST_PREREQS%%
test_bc_history_all: test_bc_history0 test_bc_history1 test_bc_history2 test_bc_history3 test_bc_history4 test_bc_history5 test_bc_history6 test_bc_history7 test_bc_history8 test_bc_history9 test_bc_history10 test_bc_history11 test_bc_history12 test_bc_history13 test_bc_history14 test_bc_history15 test_bc_history16 test_bc_history17 test_bc_history18 test_bc_history19 test_bc_history20 test_bc_history21
test_bc_history_skip:
@printf 'No bc history tests to run\n'
test_bc_history0:
@sh $(TESTSDIR)/history.sh bc 0 %%BC_TEST_EXEC%%
test_bc_history1:
@sh $(TESTSDIR)/history.sh bc 1 %%BC_TEST_EXEC%%
test_bc_history2:
@sh $(TESTSDIR)/history.sh bc 2 %%BC_TEST_EXEC%%
test_bc_history3:
@sh $(TESTSDIR)/history.sh bc 3 %%BC_TEST_EXEC%%
test_bc_history4:
@sh $(TESTSDIR)/history.sh bc 4 %%BC_TEST_EXEC%%
test_bc_history5:
@sh $(TESTSDIR)/history.sh bc 5 %%BC_TEST_EXEC%%
test_bc_history6:
@sh $(TESTSDIR)/history.sh bc 6 %%BC_TEST_EXEC%%
test_bc_history7:
@sh $(TESTSDIR)/history.sh bc 7 %%BC_TEST_EXEC%%
test_bc_history8:
@sh $(TESTSDIR)/history.sh bc 8 %%BC_TEST_EXEC%%
test_bc_history9:
@sh $(TESTSDIR)/history.sh bc 9 %%BC_TEST_EXEC%%
test_bc_history10:
@sh $(TESTSDIR)/history.sh bc 10 %%BC_TEST_EXEC%%
test_bc_history11:
@sh $(TESTSDIR)/history.sh bc 11 %%BC_TEST_EXEC%%
test_bc_history12:
@sh $(TESTSDIR)/history.sh bc 12 %%BC_TEST_EXEC%%
test_bc_history13:
@sh $(TESTSDIR)/history.sh bc 13 %%BC_TEST_EXEC%%
test_bc_history14:
@sh $(TESTSDIR)/history.sh bc 14 %%BC_TEST_EXEC%%
test_bc_history15:
@sh $(TESTSDIR)/history.sh bc 15 %%BC_TEST_EXEC%%
test_bc_history16:
@sh $(TESTSDIR)/history.sh bc 16 %%BC_TEST_EXEC%%
test_bc_history17:
@sh $(TESTSDIR)/history.sh bc 17 %%BC_TEST_EXEC%%
test_bc_history18:
@sh $(TESTSDIR)/history.sh bc 18 %%BC_TEST_EXEC%%
test_bc_history19:
@sh $(TESTSDIR)/history.sh bc 19 %%BC_TEST_EXEC%%
test_bc_history20:
@sh $(TESTSDIR)/history.sh bc 20 %%BC_TEST_EXEC%%
test_bc_history21:
@sh $(TESTSDIR)/history.sh bc 21 %%BC_TEST_EXEC%%
test_dc_history:%%DC_HISTORY_TEST_PREREQS%%
test_dc_history_all: test_dc_history0 test_dc_history1 test_dc_history2 test_dc_history3 test_dc_history4 test_dc_history5 test_dc_history6 test_dc_history7 test_dc_history8 test_dc_history9 test_dc_history10
test_dc_history_skip:
@printf 'No dc history tests to run\n'
test_dc_history0:
@sh $(TESTSDIR)/history.sh dc 0 %%DC_TEST_EXEC%%
test_dc_history1:
@sh $(TESTSDIR)/history.sh dc 1 %%DC_TEST_EXEC%%
test_dc_history2:
@sh $(TESTSDIR)/history.sh dc 2 %%DC_TEST_EXEC%%
test_dc_history3:
@sh $(TESTSDIR)/history.sh dc 3 %%DC_TEST_EXEC%%
test_dc_history4:
@sh $(TESTSDIR)/history.sh dc 4 %%DC_TEST_EXEC%%
test_dc_history5:
@sh $(TESTSDIR)/history.sh dc 5 %%DC_TEST_EXEC%%
test_dc_history6:
@sh $(TESTSDIR)/history.sh dc 6 %%DC_TEST_EXEC%%
test_dc_history7:
@sh $(TESTSDIR)/history.sh dc 7 %%DC_TEST_EXEC%%
test_dc_history8:
@sh $(TESTSDIR)/history.sh dc 8 %%DC_TEST_EXEC%%
test_dc_history9:
@sh $(TESTSDIR)/history.sh dc 9 %%DC_TEST_EXEC%%
test_dc_history10:
@sh $(TESTSDIR)/history.sh dc 10 %%DC_TEST_EXEC%%
test_history_header:
@printf '$(TEST_STARS)\n\nRunning history tests...\n\n'
library_test: $(LIBBC)
$(CC) $(CFLAGS) -lpthread $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
test_library: library_test
%%BCL_TEST_EXEC%%
karatsuba:
%%KARATSUBA%%
karatsuba_test:
%%KARATSUBA_TEST%%
coverage_output:
%%COVERAGE_OUTPUT%%
coverage:%%COVERAGE_PREREQS%%
manpages:
$(MANPAGE) bc
@@ -330,25 +559,37 @@ clean_config: clean clean_benchmarks
@$(RM) -f compile_commands.json
@$(RM) -f $(BCL_PC)
test:
@if [ $(BC_ENABLED) -ne 0 ]; then $(TESTSDIR)/all.sh -n bc $(BC_ENABLE_EXTRA_MATH) 1 $(GENERATE_TESTS) $(PROBLEMATIC_TESTS) $(BC_EXEC); fi
@if [ $(DC_ENABLED) -ne 0 ]; then $(TESTSDIR)/all.sh -n dc $(BC_ENABLE_EXTRA_MATH) 1 $(GENERATE_TESTS) $(PROBLEMATIC_TESTS) $(DC_EXEC); fi
clean_coverage:
@printf 'Cleaning coverage files...\n'
@$(RM) -f *.gcov
@$(RM) -f *.html *.css
@$(RM) -f *.gcda *.gcno
@$(RM) -f *.profraw
@$(RM) -f $(GCDA) $(GCNO)
@$(RM) -f $(BC_GCDA) $(BC_GCNO)
@$(RM) -f $(DC_GCDA) $(DC_GCNO)
@$(RM) -f $(HISTORY_GCDA) $(HISTORY_GCNO)
@$(RM) -f $(RAND_GCDA) $(RAND_GCNO)
@$(RM) -f $(BC_LIB_GCDA) $(BC_LIB_GCNO)
@$(RM) -f $(BC_LIB2_GCDA) $(BC_LIB2_GCNO)
@$(RM) -f $(BC_HELP_GCDA) $(BC_HELP_GCNO)
@$(RM) -f $(DC_HELP_GCDA) $(DC_HELP_GCNO)
clean_tests: clean clean_config
clean_tests: clean clean_config clean_coverage
@printf 'Cleaning test files...\n'
@$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
@$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
@$(RM) -f $(TESTSDIR)/bc/parse_*.txt $(TESTSDIR)/bc/parse_*_results.txt
@$(RM) -f $(TESTSDIR)/bc/print_*.txt $(TESTSDIR)/bc/print_*_results.txt
@$(RM) -f $(TESTSDIR)/bc/parse.txt $(TESTSDIR)/bc/parse_results.txt
@$(RM) -f $(TESTSDIR)/bc/print.txt $(TESTSDIR)/bc/print_results.txt
@$(RM) -f $(TESTSDIR)/bc/bessel.txt $(TESTSDIR)/bc/bessel_results.txt
@$(RM) -f $(TESTSDIR)/bc/strings2.txt $(TESTSDIR)/bc/strings2_results.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/bessel.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/parse.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/print.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/add_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/divide_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/multiply_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/subtract_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/add.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/divide.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/multiply.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/subtract.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/strings2.txt
@$(RM) -f $(TESTSDIR)/dc/scripts/prime.txt
@$(RM) -f .log_*.txt
-23
View File
@@ -1,27 +1,5 @@
# News
## 7.1.0
This is an ***UNTESTED*** release. If you would like testing, see the
[maintenance terms][23].
This fixes a few bugs:
* Improper response to double `SIGINT` with editline.
* Not letting `libedit` handle terminal size changes.
* A `dc` crash from improperly handling an error.
* A duplicate check for reference arrays.
* Build failures with GCC 15.
It also has a performance increase in the `band()` function and others in the
math library.
## 7.0.3
This is a production release that fixes build warnings on the musl libc.
Other users do ***NOT*** need to upgrade.
## 7.0.2
This is a production release that fixes `Ctrl+d` on FreeBSD and Linux when using
@@ -1610,4 +1588,3 @@ not thoroughly tested.
[20]: https://github.com/apjanke/ronn-ng
[21]: https://pandoc.org/
[22]: ./scripts/locale_uninstall.sh
[23]: ./MAINTENANCE-TERMS.md
+1 -1
View File
@@ -1,6 +1,6 @@
# Notice
Copyright 2018-2025 Gavin D. Howard and contributors.
Copyright 2018-2024 Gavin D. Howard and contributors.
## Contributors
+4 -17
View File
@@ -1,7 +1,9 @@
# `bc`
***WARNING: This project has moved back to GitHub temporarily; self-hosted Git
forges are not working for me, so I am trying to replace them.***
***WARNING: New user registration for <https://git.gavinhoward.com/> is disabled
because of spam. If you need to report a bug with `bc`, email gavin at this site
minus the `git.` part for an account, and I will create one for you. Or you can
report an issue at [GitHub][29].***
***WARNING: This project has moved to [https://git.gavinhoward.com/][20] for
[these reasons][21], though GitHub will remain a mirror.***
@@ -280,12 +282,6 @@ The easiest way to run this script is with `make karatsuba`.
If desired, maintainers can also skip running this script because there is a
sane default for the Karatsuba number.
##### `timeconst.bc`
The test suite will print a warning in normal usage. The warning is about a
missing `timeconst.bc`. This file [comes from][37] the [Linux kernel][38], which
has an incompatible license. The warning can be ignored.
## Status
This `bc` is robust.
@@ -436,8 +432,6 @@ Other projects based on this bc are:
* [macOS `bc`][35]. Any bugs in that `bc` should be reported to me, but do
expect bugs because the version is old.
* [Android Open Source `bc`][32]. Any bugs in that `bc` can be reported here.
* [A Fedora package][36]. If this package does not have any patches, you can
report bugs to me.
This is a non-comprehensive list of Linux distros that use this `bc` as the
system `bc`:
@@ -475,16 +469,12 @@ Files:
.gitignore The git ignore file (maintainer use only).
.gitattributes The git attributes file (maintainer use only).
bcl.pc.in A template pkg-config file for bcl.
build.gaml The GAML file with options for building under Rig.
build.pkg.rig The Rig build package file.
build.rig The Rig build script.
configure A symlink to configure.sh to make packaging easier.
configure.sh The configure script.
LICENSE.md A Markdown form of the BSD 2-clause License.
Makefile.in The Makefile template.
NEWS.md The changelog.
NOTICE.md List of contributors and copyright owners.
VERSION.txt A file containing the version.
Folders:
@@ -526,6 +516,3 @@ Folders:
[33]: https://github.com/gentoo/gentoo/blob/master/app-alternatives/bc/bc-0.ebuild#L8
[34]: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/bc.html
[35]: https://github.com/apple-oss-distributions/bc/tree/main/bc
[36]: https://copr.fedorainfracloud.org/coprs/tkbcopr/bc-gh/
[37]: https://github.com/torvalds/linux/blob/master/kernel/time/timeconst.bc
[38]: https://github.com/torvalds/linux
-1
View File
@@ -1 +0,0 @@
7.1.0
-402
View File
@@ -1,402 +0,0 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The build options file.
*
*/
project: @com.gavinhoward.bc
language: @C11
version: {
min: @24.04.05
}
mode: {
language: @iterative
stampers: @metadata
dependencies: @dynamic
}
default_target: @all
presets: {
debug: {
debug: true
optimization: "0"
memcheck: true
devtools: true
strip: false
}
release: {
optimization: "3"
lto: true
}
// This is the predefined build for BSDs.
bsd: {
optimization: "3"
history: @editline
generated_tests: false
install_manpages: false
install_locales: @system
strip: true
bc_default_banner: false
bc_default_sigint_reset: true
dc_default_sigint_reset: true
bc_default_tty_mode: true
dc_default_tty_mode: false
bc_default_prompt: @off
dc_default_prompt: @off
bc_default_expr_exit: true
dc_default_expr_exit: true
bc_default_digit_clamp: false
dc_default_digit_clamp: false
}
// This is the predefined build to match the GNU bc/dc.
gnu: {
optimization: "3"
generated_tests: false
install_manpages: true
install_locales: @system
strip: true
bc_default_banner: true
bc_default_sigint_reset: true
dc_default_sigint_reset: false
bc_default_tty_mode: true
dc_default_tty_mode: false
bc_default_prompt: @tty_mode
dc_default_prompt: @tty_mode
bc_default_expr_exit: true
dc_default_expr_exit: true
bc_default_digit_clamp: false
dc_default_digit_clamp: false
}
// This is the preferred release build of the author, Gavin D. Howard.
gdh: {
optimization: "3"
install_manpages: true
install_locales: @none
bc/default_banner: true
bc/default_sigint_reset: true
dc/default_sigint_reset: true
bc/default_tty_mode: true
dc/default_tty_mode: true
bc/default_prompt: @tty_mode
dc/default_prompt: @tty_mode
bc/default_expr_exit: false
dc/default_expr_exit: false
bc/default_digit_clamp: true
dc/default_digit_clamp: true
}
// This is the preferred debug build of the author, Gavin D. Howard.
dbg: {
optimization: "0"
debug: true
strip: false
install_manpages: true
install_locales: @system
bc/default_banner: true
bc/default_sigint_reset: true
dc/default_sigint_reset: true
bc/default_tty_mode: true
dc/default_tty_mode: true
bc/default_prompt: @tty_mode
dc/default_prompt: @tty_mode
bc/default_expr_exit: false
dc/default_expr_exit: false
bc/default_digit_clamp: true
dc/default_digit_clamp: true
}
}
default_development: @debug
default_release: @release
options: {
build_mode: {
type: @option
options: [
@both
@bc
@dc
@library
]
default: @both
desc: "Which of the executables or library to build."
}
extra_math: {
type: @bool
default: true
desc: "Enable the extra math extensions."
}
history: {
type: @option
options: [
@none
@builtin
@editline
@readline
]
default: @builtin
desc: "Which history implementation should be used, if any."
}
locales: {
type: @option
options: [
@none
@system
@all
]
default: @system
desc: "Whether to disable locales, use just the system ones, or use all (for building a package)."
}
bc/default_banner: {
type: @bool
default: false
desc: "Whether to display the bc version banner by default when in interactive mode."
}
bc/default_sigint_reset: {
type: @bool
default: true
desc: "Whether SIGINT will reset bc by default, instead of exiting, when in interactive mode."
}
dc/default_sigint_reset: {
type: @bool
default: true
desc: "Whether SIGINT will reset dc by default, instead of exiting, when in interactive mode."
}
bc/default_tty_mode: {
type: @bool
default: true
desc: "Whether TTY mode for bc should be on by default when available."
}
dc/default_tty_mode: {
type: @bool
default: false
desc: "Whether TTY mode for dc should be on by default when available."
}
bc/default_prompt: {
type: @option
options: [
@off
@tty_mode
@on
]
default: @tty_mode
desc: "Whether the prompt for bc should be on by default in TTY mode. This defaults to match TTY mode."
}
dc/default_prompt: {
type: @option
options: [
@off
@tty_mode
@on
]
default: @tty_mode
desc: "Whether the prompt for dc should be on by default in TTY mode. This defaults to match TTY mode."
}
bc/default_expr_exit: {
type: @bool
default: true
desc: "Whether to exit bc by default if an expression or expression file is given with the -e or -f options."
}
dc/default_expr_exit: {
type: @bool
default: true
desc: "Whether to exit dc by default if an expression or expression file is given with the -e or -f options."
}
bc/default_digit_clamp: {
type: @bool
default: false
desc: "Whether to have bc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
}
dc/default_digit_clamp: {
type: @bool
default: false
desc: "Whether to have dc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
}
karatsuba_len: {
type: @num
default: 32
desc: "Set the Karatsuba length (default is 32). Must be a number and greater than or equal to 16."
}
execprefix: {
type: @string
default: ""
desc: "The prefix to prepend to the executable names, to prevent collisions."
}
execsuffix: {
type: @string
default: ""
desc: "The suffix to append to the executable names, to prevent collisions."
}
debug: {
type: @bool
default: false
desc: "Enable debug info."
}
optimization: {
type: @string
default: "0"
desc: "The optimization level for the C compiler."
}
lto: {
type: @bool
default: false
desc: "Build with link-time optimization, if available."
}
strip: {
type: @bool
default: true
desc: "Strip any binaries."
}
strict: {
type: @bool
default: true
desc: "Build with strict compiler options."
}
force: {
type: @bool
default: false
desc: "Force options that don't work. THIS IS FOR DEV ONLY!"
}
memcheck: {
type: @bool
default: false
desc: "Enable memcheck mode, to check for memory leaks."
}
valgrind: {
type: @bool
default: false
desc: "Enable Valgrind mode, to check for memory bugs."
}
afl: {
type: @bool
default: false
desc: "Enable AFL++ mode."
}
ossfuzz: {
type: @bool
default: false
desc: "Enable OSSFUZZ mode."
}
generated_tests: {
type: @bool
default: true
desc: "Enable tests generated from a GNU bc-compatible program."
}
problematic_tests: {
type: @bool
default: true
desc: "Enable tests that may be problematic."
}
coverage: {
type: @bool
default: false
desc: "Enable code coverage (only works on GCC)."
}
install_manpages: {
type: @bool
default: true
desc: "Whether to install manpages or not."
}
cflags: {
type: @list
default: []
desc: "The command-line flags for the C compiler."
}
ldflags: {
type: @list
default: []
desc: "The command-line flags for the C linker."
}
destdir: {
type: @path
default: ""
desc: "The equivalent of $DESTDIR in other build systems."
}
prefix: {
type: @path
default: "/usr/local"
desc: "The default prefix to install everything into."
}
bindir: {
type: @path
default: ""
desc: "The directory to install executables into. Defaults to \"$prefix/bin\"."
}
libdir: {
type: @path
default: ""
desc: "The directory to install libraries into. Defaults to \"$prefix/lib\"."
}
includedir: {
type: @path
default: ""
desc: "The location to install headers in. Defaults to \"$prefix/include\"."
}
nlspath: {
type: @path
default: "/usr/share/locale/%L/%N"
desc: "The location to install locales."
}
pc_path: {
type: @path
default: ""
desc: "The location to pkg-config files to. Defaults to the output of `pkg-config --variable=pc_path pkg-config`."
}
datarootdir: {
type: @path
default: ""
desc: "The root directory for data files. Defaults to `$prefix/share`."
}
datadir: {
type: @path
default: ""
desc: "The directory for data files. Defaults to `$datarootdir`."
}
mandir: {
type: @path
default: ""
desc: "The root directory for manpages. Defaults to `$datadir/man`."
}
man1dir: {
type: @path
default: ""
desc: "The directory for manpages in section 1. Defaults to `$mandir/man1`."
}
man3dir: {
type: @path
default: ""
desc: "The directory for manpages in section 3. Defaults to `$mandir/man3`."
}
}
File diff suppressed because it is too large. Load diff
-575
View File
@@ -1,575 +0,0 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The build script file.
*
*/
if OS == "Windows" && bool(config["lto"])
{
error("Link-time optimization is not supported on Windows");
}
if LIBRARY_ENABLED == "0"
{
if OS != "Windows" && NLS_ENABLED != "0"
{
io.eprint("Testing NLS...\n");
clang_flags: []str =
if CC contains "clang"
{
@[ "-Wno_unreachable-code" ];
};
flags: []str = clang_flags +~ @[
DEFOPT +~ "BC_ENABLE_NLS=1",
DEFOPT +~ "BC_ENABLED=" +~ BC_ENABLED,
DEFOPT +~ "DC_ENABLED=" +~ DC_ENABLED,
DEFOPT +~ "BC_ENABLE_HISTORY=0",
DEFOPT +~ "BC_ENABLE_LIBRARY=0",
DEFOPT +~ "BC_ENABLE_AFL=0",
DEFOPT +~ "BC_ENABLE_EXTRA_MATH=" +~ EXTRA_MATH_ENABLED,
DEFOPT +~ "BC_ENABLE_OSSFUZZ=0",
DEFOPT +~ "_POSIX_C_SOURCE=200809L",
DEFOPT +~ "_XOPEN_SOURCE=700",
INCOPT,
];
res := $ $CC %(flags) -c @(path.join(src_dir, "src/vm.c")) -E;
if res.exitcode != 0
{
if FORCE
{
io.eprint("Forcing NLS...\n");
}
else
{
error("NLS does not work\n");
}
}
else
{
if path.isfile("vm.o")
{
path.rm("vm.o");
}
io.eprint("NLS works.\n\n");
io.eprint("Testing gencat...\n");
res2 := $ gencat ./en_US.cat
@(path.join(src_dir, "locales/en_US.msg"));
if res2.exitcode != 0
{
if FORCE
{
io.eprint("Forcing NLS...\n");
}
else
{
error("gencat does not work\n");
}
}
else
{
io.eprint("gencat works.\n\n");
if platform != host
{
error("Cross compiles will not work!\n\n");
}
}
}
}
if OS != "Windows" && sym(config["history"]) != @none
{
io.eprint("Testing history...\n");
flags: []str = @[
DEFOPT +~ "BC_ENABLE_HISTORY=1",
DEFOPT +~ "BC_ENABLED=" +~ BC_ENABLED,
DEFOPT +~ "DC_ENABLED=" +~ DC_ENABLED,
DEFOPT +~ "BC_ENABLE_NLS=" +~ NLS_ENABLED,
DEFOPT +~ "BC_ENABLE_LIBRARY=0",
DEFOPT +~ "BC_ENABLE_AFL=0",
DEFOPT +~ "BC_ENABLE_EDITLINE=" +~ EDITLINE_ENABLED,
DEFOPT +~ "BC_ENABLE_READLINE=" +~ READLINE_ENABLED,
DEFOPT +~ "BC_ENABLE_EXTRA_MATH=" +~ EXTRA_MATH_ENABLED,
DEFOPT +~ "BC_ENABLE_OSSFUZZ=0",
DEFOPT +~ "_POSIX_C_SOURCE=200809L",
DEFOPT +~ "_XOPEN_SOURCE=700",
INCOPT,
];
res := $ $CC %(flags) -c @(path.join(src_dir, "src/history.c")) -E;
if res.exitcode != 0
{
if FORCE
{
io.eprint("Forcing history...\n");
}
else
{
error("History does not work\n");
}
}
else
{
if path.isfile("history.o")
{
path.rm("history.o");
}
io.eprint("History works.\n\n");
}
}
}
freebsd_flags: []str =
if OS != "FreeBSD"
{
@[ DEFOPT +~ "_POSIX_C_SOURCE=200809L", DEFOPT +~ "_XOPEN_SOURCE=700" ];
};
macos: bool = (OS == "Darwin");
macos_flags: []str =
if macos
{
@[ DEFOPT +~ "_DARWIN_C_SOURCE" ];
};
openbsd_flags: []str =
if OS == "OpenBSD"
{
if READLINE_ENABLED != "0"
{
error("Cannot use readline on OpenBSD");
}
@[ DEFOPT +~ "_BSD_SOURCE" ];
};
strip_flag: []str =
if OS != "Windows" && !bool(config["debug"]) && !macos && bool(config["strip"])
{
@[ "-s" ];
};
lto_flag: []str =
if bool(config["lto"])
{
@[ "-flto" ];
};
strict_flags: []str =
if bool(config["strict"])
{
// Strict build only works for GCC and Clang, so we do want to set that
// here.
if CC contains "gcc" || CC contains "clang"
{
// These are the standard strict build flags for both compilers.
std_strict: []str = @[ "-Wall", "-Wextra", "-Werror", "-pedantic" ];
// Clang has -Weverything, which I ensure Yc builds under.
//
// I also want unlimited errors because Clang is my development
// compiler; it caps at 20 by default.
compiler_strict: []str =
if CC contains "clang"
{
// Oh, and add the standard.
@[ "-Weverything", "-ferror-limit=100000", "-Wno-padded",
"-Wno-unknown-warning-option", "-Wno-unsafe-buffer-usage",
"-Wno-documentation-unknown-command", "-Wno-pre-c11-compat",
"-Wno-enum-enum-conversion", "-Wno-switch-default" ];
};
// Return the combination of the sets.
std_strict +~ compiler_strict;
}
else if OS == "Windows"
{
// Return the combo of the strict options, the standard, and the
// sanitizer defines.
@[ "/W4", "/WX", "/wd\"4996\"", "/permissive-" ];
}
};
version_contents: str = io.read_file(path.join(src_dir, "VERSION.txt"));
version_lines: []str = version_contents.split("\n");
version: str = version_lines[0];
version_flag: []str = @[ DEFOPT +~ "VERSION=" +~ version ];
other_flags: []str = freebsd_flags +~ macos_flags +~ openbsd_flags +~
lto_flag +~ strict_flags +~ version_flag +~
if bool(config["debug"])
{
@[ compiler_db["opt.debug"] ];
};
history_files: []str =
if HISTORY != @none
{
HISTORY_C_FILES;
};
c_files: []str =
if BUILD_MODE == @both
{
COMMON_C_FILES +~ EXEC_C_FILES +~ BC_C_FILES +~ DC_C_FILES +~ history_files;
}
else if BUILD_MODE == @bc
{
COMMON_C_FILES +~ EXEC_C_FILES +~ BC_C_FILES +~ history_files;
}
else if BUILD_MODE == @dc
{
COMMON_C_FILES +~ EXEC_C_FILES +~ DC_C_FILES +~ history_files;
}
else
{
COMMON_C_FILES +~ LIBRARY_C_FILES;
};
build_config: Gaml = @(gaml){
other_cflags: $other_flags
strip_flag: $strip_flag
};
targets: []str =
push build_config: config_stack
{
gen_o_files: []str =
if BUILD_MODE != @library
{
@[
txt2o("gen/lib.bc", "bc_lib", "bc_lib_name", "BC_ENABLED", true),
txt2o("gen/lib2.bc", "bc_lib2", "bc_lib2_name",
"BC_ENABLED && BC_ENABLE_EXTRA_MATH", true),
txt2o("gen/bc_help.txt", "bc_help", "", "BC_ENABLED", false),
txt2o("gen/dc_help.txt", "dc_help", "", "DC_ENABLED", false),
];
};
obj_files: []str = gen_o_files +~
for f: c_files
{
c2o(f);
};
if BUILD_MODE == @both || BUILD_MODE == @bc
{
if OS != "Windows" && bool(config["install_manpages"])
{
src: str = path.join("manuals/bc", BUILD_TYPE +~ ".1");
target BC_MANPAGE: src
{
$ cp -f @(file_dep) @(tgt);
}
}
exe(BC_BIN, obj_files);
}
if BUILD_MODE == @both || BUILD_MODE == @dc
{
if OS != "Windows" && bool(config["install_manpages"])
{
src: str = path.join("manuals/dc", BUILD_TYPE +~ ".1");
target DC_MANPAGE: src
{
$ cp -f @(file_dep) @(tgt);
}
}
if BUILD_MODE == @both
{
ln(DC_BIN, BC_BIN);
}
else
{
exe(DC_BIN, obj_files);
}
}
if BUILD_MODE == @library
{
lib(LIBRARY, obj_files);
}
if BUILD_MODE == @both
{
@[ BC_BIN, DC_BIN ];
}
else if BUILD_MODE == @bc
{
@[ DC_BIN ];
}
else if BUILD_MODE == @dc
{
@[ DC_BIN ];
}
else
{
includedir: str = get_includedir();
libdir: str = get_libdir();
pc_config: Gaml = @(gaml){
INCLUDEDIR: $includedir
LIBDIR: $libdir
VERSION: $version
};
push pc_config: config_stack
{
target PC_FILE: PC_FILE +~ ".in"
{
configure_file(file_dep, tgt, "%%");
}
}
@[ LIBRARY, PC_FILE ];
}
};
if OS != "Windows"
{
if LIBRARY_ENABLED == "0"
{
target @install: targets
{
bindir: str = get_bindir();
if BC_ENABLED != "0"
{
$ $SAFE_INSTALL $EXEC_INSTALL_MODE $BC_BIN
@(path.join(bindir, BC_BIN));
}
if DC_ENABLED != "0"
{
if BC_ENABLED != "0"
{
$ ln -sf @("./" +~ BC_BIN) @(path.join(bindir, DC_BIN));
}
else
{
$ $SAFE_INSTALL $EXEC_INSTALL_MODE $BC_BIN
@(path.join(bindir, BC_BIN));
}
}
if NLS_ENABLED != "0"
{
locale_install_args: []str =
if sym(config["locales"]) == @all
{
@[ "-l" ];
};
if DESTDIR != ""
{
$ @(path.join(src_dir, "scripts/locale_install.sh"))
%(locale_install_args) @(str(config["nlspath"]))
$MAINEXEC $DESTDIR;
}
else
{
$ @(path.join(src_dir, "scripts/locale_install.sh"))
%(locale_install_args) @(str(config["nlspath"]))
$MAINEXEC;
}
}
if bool(config["install_manpages"])
{
man1dir: str = get_man1dir();
if BC_ENABLED != "0"
{
$ rm -rf @(path.join(man1dir, BC_MANPAGE));
}
if DC_ENABLED != "0"
{
$ rm -rf @(path.join(man1dir, DC_MANPAGE));
}
}
}
target @uninstall
{
bindir: str = get_bindir();
if BC_ENABLED != "0"
{
$ rm -rf @(path.join(bindir, BC_BIN));
}
if DC_ENABLED != "0"
{
$ rm -rf @(path.join(bindir, DC_BIN));
}
if NLS_ENABLED != "0"
{
if DESTDIR != ""
{
$ @(path.join(src_dir, "scripts/locale_uninstall.sh"))
@(str(config["nlspath"])) $MAINEXEC $DESTDIR;
}
else
{
$ @(path.join(src_dir, "scripts/locale_uninstall.sh"))
@(str(config["nlspath"])) $MAINEXEC;
}
}
if bool(config["install_manpages"])
{
man1dir: str = get_man1dir();
$ rm -rf @(path.join(man1dir, BC_MANPAGE))
@(path.join(man1dir, DC_MANPAGE));
}
}
}
else
{
target @install: targets, BCL_HEADER_PATH
{
full_libdir: str = get_libdir();
$ $SAFE_INSTALL $EXEC_INSTALL_MODE @(file_dep)
@(path.join(full_libdir, file_dep));
full_pc_path: str = get_pc_path();
bcl_pc: str = file_deps[1];
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE $bcl_pc
@(path.join(full_pc_path, bcl_pc));
full_includedir: str = get_includedir();
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE @(file_deps[2])
@(path.join(full_includedir, BCL_HEADER));
if bool(config["install_manpages"])
{
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE
@(path.join(src_dir, path.join("manuals", BCL_MANPAGE)))
@(path.join(get_man3dir(), BCL_MANPAGE));
}
}
target @uninstall
{
$ rm -rf @(path.join(get_libdir(), LIBRARY))
@(path.join(get_pc_path(), PC_FILE))
@(path.join(get_includedir(), BCL_HEADER));
if bool(config["install_manpages"])
{
$ rm -rf @(path.join(get_man3dir(), BCL_MANPAGE));
}
}
}
}
// If the platform matches the host, we can run the test suite.
if platform == host
{
// If we have the library, build and run that test.
if BUILD_MODE == @library
{
libtesto: str = c2o("tests/bcl.c");
libtest: str = "bcl";
exe(libtest, @[ libtesto, targets[0] ]);
test @bcl: libtest
{
$ @(str(tgt_name));
}
}
else
{
if BUILD_MODE != @dc
{
exe_tests("bc");
}
if BUILD_MODE != @bc
{
exe_tests("dc");
}
target @clean_tests
{
for f: path.find_ext(build_dir, "txt")
{
path.rm(f);
}
}
}
}
target "bitfuncgen"
{
error("TODO: Make this");
}
target @bitfuncgen: "bitfuncgen"
{
error("TODO: Make this");
}
target "ministat"
{
error("TODO: Make this");
}
target @ministat: "ministat"
{
error("TODO: Make this");
}
target @all: targets;
-3
View File
@@ -1,9 +1,6 @@
-Weverything
-pedantic
-Wno-unsafe-buffer-usage
-Wno-pre-c11-compat
-Wno-unknown-warning-option
-Wno-switch-default
-D_POSIX_C_SOURCE=200809L
-D_XOPEN_SOURCE=700
-D_BSD_SOURCE
+455 -26
View File
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -55,7 +55,7 @@ usage() {
printf ' %s [-a|-bD|-dB|-c] [-CeEfgGHilmMNPrtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\\\n' "$script"
printf ' [-s SETTING] [-S SETTING] [-p TYPE]\n'
printf ' %s \\\n' "$script"
printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc] \\\n'
printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage] \\\n'
printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n'
printf ' [--disable-history --disable-man-pages --disable-nls --disable-strip] \\\n'
printf ' [--enable-editline] [--enable-readline] [--enable-internal-history] \\\n'
@@ -74,7 +74,7 @@ usage() {
printf '\n'
printf ' -a, --library\n'
printf ' Build the libbcl instead of the programs. This is meant to be used with\n'
printf ' other software like programming languages that want to make use of the\n'
printf ' Other software like programming languages that want to make use of the\n'
printf ' parsing and math capabilities. This option will install headers using\n'
printf ' `make install`.\n'
printf ' -b, --bc-only\n'
@@ -83,6 +83,10 @@ usage() {
printf ' -B, --disable-bc\n'
printf ' Disable bc. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n'
printf ' are specified too.\n'
printf ' -c, --coverage\n'
printf ' Generate test coverage code. Requires gcov and gcovr.\n'
printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n'
printf ' Requires a compiler that use gcc-compatible coverage options\n'
printf ' -C, --disable-clean\n'
printf ' Disable the clean that configure.sh does before configure.\n'
printf ' -d, --dc-only\n'
@@ -129,6 +133,8 @@ usage() {
printf ' Installs all locales, regardless of how many are on the system. This\n'
printf ' option is useful for package maintainers who want to make sure that\n'
printf ' a package contains all of the locales that end users might need.\n'
printf ' -m, --enable-memcheck\n'
printf ' Enable memcheck mode, to ensure no memory leaks. For development only.\n'
printf ' -M, --disable-man-pages\n'
printf ' Disable installing manpages.\n'
printf ' -N, --disable-nls\n'
@@ -166,9 +172,17 @@ usage() {
printf ' Set the default named by SETTING to off. See below for possible values\n'
printf ' for SETTING. For multiple instances of the -s or -S for the the same\n'
printf ' setting, the last one is used.\n'
printf ' -t, --enable-test-timing\n'
printf ' Enable the timing of tests. This is for development only.\n'
printf ' -T, --disable-strip\n'
printf ' Disable stripping symbols from the compiled binary or binaries.\n'
printf ' Stripping symbols only happens when debug mode is off.\n'
printf ' -v, --enable-valgrind\n'
printf ' Enable a build appropriate for valgrind. For development only.\n'
printf ' -z, --enable-fuzz-mode\n'
printf ' Enable fuzzing mode. THIS IS FOR DEVELOPMENT ONLY.\n'
printf ' -Z, --enable-ossfuzz-mode\n'
printf ' Enable fuzzing mode for OSS-Fuzz. THIS IS FOR DEVELOPMENT ONLY.\n'
printf ' --prefix PREFIX\n'
printf ' The prefix to install to. Overrides "$PREFIX" if it exists.\n'
printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n'
@@ -240,12 +254,12 @@ usage() {
printf ' path (or contain one). This is treated the same as the POSIX\n'
printf ' definition of $NLSPATH (see POSIX environment variables for\n'
printf ' more information). Default is "/usr/share/locale/%%L/%%N".\n'
printf ' PC_PATH The location to install pkg-config files to. Must be a\n'
printf ' PC_PATH The location to install pkg-config files to. Must be an\n'
printf ' path or contain one. Default is the first path given by the\n'
printf ' output of `pkg-config --variable=pc_path pkg-config`.\n'
printf ' EXECSUFFIX The suffix to append to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' EXECPREFIX The prefix to prepend to the executable names, used to not\n'
printf ' EXECPREFIX The prefix to append to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' DESTDIR For package creation. Default is "". If it is empty when\n'
printf ' `%s` is run, it can also be passed to `make install`\n' "$script"
@@ -468,7 +482,7 @@ find_src_files() {
}
# This function generates a list of files to go into the Makefile. It generates
# the list of object files.
# the list of object files, as well as the list of test coverage files.
#
# @param contents The contents of the Makefile template to put the list of
# files into.
@@ -489,6 +503,8 @@ gen_file_list() {
_gen_file_list_needle_src="SRC"
_gen_file_list_needle_obj="OBJ"
_gen_file_list_needle_gcda="GCDA"
_gen_file_list_needle_gcno="GCNO"
_gen_file_list_replacement=$(find_src_files $_gen_file_list_unneeded | tr '\n' ' ')
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
@@ -505,9 +521,151 @@ gen_file_list() {
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_obj" "$_gen_file_list_replacement")
_gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "o" "gcda")
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_gcda" "$_gen_file_list_replacement")
_gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "gcda" "gcno")
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_gcno" "$_gen_file_list_replacement")
printf '%s\n' "$_gen_file_list_contents"
}
# Generates the proper test targets for each test to have its own target. This
# allows `make test` to run in parallel.
#
# @param name Which calculator to generate tests for.
# @param extra_math An integer that, if non-zero, activates extra math tests.
# @param time_tests An integer that, if non-zero, tells the test suite to time
# the execution of each test.
gen_std_tests() {
_gen_std_tests_name="$1"
shift
_gen_std_tests_extra_math="$1"
shift
_gen_std_tests_time_tests="$1"
shift
_gen_std_tests_extra_required=$(cat "$scriptdir/tests/extra_required.txt")
for _gen_std_tests_t in $(cat "$scriptdir/tests/$_gen_std_tests_name/all.txt"); do
if [ "$_gen_std_tests_extra_math" -eq 0 ]; then
if [ -z "${_gen_std_tests_extra_required##*$_gen_std_tests_t*}" ]; then
printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \
"$_gen_std_tests_name" "$_gen_std_tests_t" "$_gen_std_tests_name" \
"$_gen_std_tests_t" >> "Makefile"
continue
fi
fi
printf 'test_%s_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/test.sh %s %s %s %s %s\n\n' \
"$_gen_std_tests_name" "$_gen_std_tests_t" "$builddir" "$_gen_std_tests_name" \
"$_gen_std_tests_t" "$generate_tests" "$time_tests" \
"$*" >> "Makefile"
done
}
# Generates a list of test targets that will be used as prerequisites for other
# targets.
#
# @param name The name of the calculator to generate test targets for.
gen_std_test_targets() {
_gen_std_test_targets_name="$1"
shift
_gen_std_test_targets_tests=$(cat "$scriptdir/tests/${_gen_std_test_targets_name}/all.txt")
for _gen_std_test_targets_t in $_gen_std_test_targets_tests; do
printf ' test_%s_%s' "$_gen_std_test_targets_name" "$_gen_std_test_targets_t"
done
printf '\n'
}
# Generates the proper test targets for each error test to have its own target.
# This allows `make test_bc_errors` and `make test_dc_errors` to run in
# parallel.
#
# @param name Which calculator to generate tests for.
gen_err_tests() {
_gen_err_tests_name="$1"
shift
_gen_err_tests_fs=$(ls "$scriptdir/tests/$_gen_err_tests_name/errors/")
for _gen_err_tests_t in $_gen_err_tests_fs; do
printf 'test_%s_error_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/error.sh %s %s %s %s\n\n' \
"$_gen_err_tests_name" "$_gen_err_tests_t" "$builddir" "$_gen_err_tests_name" \
"$_gen_err_tests_t" "$problematic_tests" "$*" >> "Makefile"
done
}
# Generates a list of error test targets that will be used as prerequisites for
# other targets.
#
# @param name The name of the calculator to generate test targets for.
gen_err_test_targets() {
_gen_err_test_targets_name="$1"
shift
_gen_err_test_targets_tests=$(ls "$scriptdir/tests/$_gen_err_test_targets_name/errors/")
for _gen_err_test_targets_t in $_gen_err_test_targets_tests; do
printf ' test_%s_error_%s' "$_gen_err_test_targets_name" "$_gen_err_test_targets_t"
done
printf '\n'
}
# Generates the proper script test targets for each script test to have its own
# target. This allows `make test` to run in parallel.
#
# @param name Which calculator to generate tests for.
# @param extra_math An integer that, if non-zero, activates extra math tests.
# @param generate An integer that, if non-zero, activates generated tests.
# @param time_tests An integer that, if non-zero, tells the test suite to time
# the execution of each test.
gen_script_tests() {
_gen_script_tests_name="$1"
shift
_gen_script_tests_extra_math="$1"
shift
_gen_script_tests_generate="$1"
shift
_gen_script_tests_time="$1"
shift
_gen_script_tests_tests=$(cat "$scriptdir/tests/$_gen_script_tests_name/scripts/all.txt")
for _gen_script_tests_f in $_gen_script_tests_tests; do
_gen_script_tests_b=$(basename "$_gen_script_tests_f" ".${_gen_script_tests_name}")
printf 'test_%s_script_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/script.sh %s %s %s 1 %s %s %s\n\n' \
"$_gen_script_tests_name" "$_gen_script_tests_b" "$builddir" "$_gen_script_tests_name" \
"$_gen_script_tests_f" "$_gen_script_tests_extra_math" "$_gen_script_tests_generate" \
"$_gen_script_tests_time" "$*" >> "Makefile"
done
}
set_default() {
_set_default_on="$1"
@@ -552,6 +710,7 @@ predefined_build() {
BSD)
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -564,6 +723,11 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=0
bc_default_sigint_reset=1
@@ -580,6 +744,7 @@ predefined_build() {
GNU)
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -592,6 +757,11 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -607,10 +777,10 @@ predefined_build() {
GDH)
CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
CFLAGS="$CFLAGS -Wno-switch-default -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -623,6 +793,11 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -638,10 +813,10 @@ predefined_build() {
DBG)
CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
CFLAGS="$CFLAGS -Wno-switch-default -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
debug=1
optimization="0"
hist=1
@@ -654,6 +829,11 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=1
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -672,12 +852,36 @@ predefined_build() {
esac
}
# Generates a list of script test targets that will be used as prerequisites for
# other targets.
#
# @param name The name of the calculator to generate script test targets for.
gen_script_test_targets() {
_gen_script_test_targets_name="$1"
shift
_gen_script_test_targets_tests=$(cat "$scriptdir/tests/$_gen_script_test_targets_name/scripts/all.txt")
for _gen_script_test_targets_f in $_gen_script_test_targets_tests; do
_gen_script_test_targets_b=$(basename "$_gen_script_test_targets_f" \
".$_gen_script_test_targets_name")
printf ' test_%s_script_%s' "$_gen_script_test_targets_name" \
"$_gen_script_test_targets_b"
done
printf '\n'
}
# This is a list of defaults, but it is also the list of possible options for
# users to change.
#
# The development options are: force (force options even if they fail).
# The development options are: force (force options even if they fail), valgrind
# (build in a way suitable for valgrind testing), memcheck (same as valgrind),
# and fuzzing (build in a way suitable for fuzzing).
bc_only=0
dc_only=0
coverage=0
karatsuba_len=32
debug=0
hist=1
@@ -691,6 +895,11 @@ force=0
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
problematic_tests=1
@@ -711,12 +920,13 @@ dc_default_digit_clamp=0
# getopts is a POSIX utility, but it cannot handle long options. Thus, the
# handling of long options is done by hand, and that's the reason that short and
# long options cannot be mixed.
while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
case "$opt" in
a) library=1 ;;
b) bc_only=1 ;;
B) dc_only=1 ;;
c) coverage=1 ;;
C) clean=0 ;;
d) dc_only=1 ;;
D) bc_only=1 ;;
@@ -730,6 +940,7 @@ while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
i) hist_impl="internal" ;;
k) karatsuba_len="$OPTARG" ;;
l) all_locales=1 ;;
m) memcheck=1 ;;
M) install_manpages=0 ;;
N) nls=0 ;;
O) optimization="$OPTARG" ;;
@@ -738,7 +949,11 @@ while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
r) hist_impl="readline" ;;
S) set_default 0 "$OPTARG" ;;
s) set_default 1 "$OPTARG" ;;
t) time_tests=1 ;;
T) strip_bin=0 ;;
v) vg=1 ;;
z) fuzz=1 ;;
Z) ossfuzz=1 ;;
-)
arg="$1"
arg="${arg#--}"
@@ -748,6 +963,7 @@ while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
library) library=1 ;;
bc-only) bc_only=1 ;;
dc-only) dc_only=1 ;;
coverage) coverage=1 ;;
debug) debug=1 ;;
force) force=1 ;;
prefix=?*) PREFIX="$LONG_OPTARG" ;;
@@ -861,20 +1077,27 @@ while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
enable-editline) hist_impl="editline" ;;
enable-readline) hist_impl="readline" ;;
enable-internal-history) hist_impl="internal" ;;
enable-test-timing) time_tests=1 ;;
enable-valgrind) vg=1 ;;
enable-fuzz-mode) fuzz=1 ;;
enable-ossfuzz-mode) ossfuzz=1 ;;
enable-memcheck) memcheck=1 ;;
install-all-locales) all_locales=1 ;;
help* | bc-only* | dc-only* | debug*)
help* | bc-only* | dc-only* | coverage* | debug*)
usage "No arg allowed for --$arg option" ;;
disable-bc* | disable-dc* | disable-clean*)
usage "No arg allowed for --$arg option" ;;
disable-extra-math*)
usage "No arg allowed for --$arg option" ;;
disable-history*)
disable-generated-tests* | disable-history*)
usage "No arg allowed for --$arg option" ;;
disable-man-pages* | disable-nls* | disable-strip*)
usage "No arg allowed for --$arg option" ;;
disable-problematic-tests*)
usage "No arg allowed for --$arg option" ;;
install-all-locales*)
enable-fuzz-mode* | enable-test-timing* | enable-valgrind*)
usage "No arg allowed for --$arg option" ;;
enable-memcheck* | install-all-locales*)
usage "No arg allowed for --$arg option" ;;
enable-editline* | enable-readline*)
usage "No arg allowed for --$arg option" ;;
@@ -998,7 +1221,33 @@ link="@printf 'No link necessary\\\\n'"
main_exec="BC"
executable="BC_EXEC"
tests="test_bc timeconst test_dc"
bc_test="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh bc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(BC_EXEC)"
bc_test_np="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh -n bc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(BC_EXEC)"
dc_test="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh dc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(DC_EXEC)"
dc_test_np="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh -n dc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(DC_EXEC)"
timeconst="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/bc/timeconst.sh \$(TESTSDIR)/bc/scripts/timeconst.bc \$(BC_EXEC)"
# In order to have cleanup at exit, we need to be in
# debug mode, so don't run valgrind without that.
if [ "$vg" -ne 0 ]; then
debug=1
bc_test_exec='valgrind $(VALGRIND_ARGS) $(BC_EXEC)'
dc_test_exec='valgrind $(VALGRIND_ARGS) $(DC_EXEC)'
bcl_test_exec='valgrind $(VALGRIND_ARGS) $(BCL_TEST)'
else
bc_test_exec='$(BC_EXEC)'
dc_test_exec='$(DC_EXEC)'
bcl_test_exec='$(BCL_TEST)'
fi
test_bc_history_prereqs="test_bc_history_all"
test_dc_history_prereqs="test_dc_history_all"
karatsuba="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
karatsuba_test="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
bc_lib="\$(GEN_DIR)/lib.o"
bc_help="\$(GEN_DIR)/bc_help.o"
@@ -1025,6 +1274,9 @@ if [ "$library" -ne 0 ]; then
default_target_prereqs="\$(BIN) \$(OBJ)"
default_target_cmd="ar -r -cu \$(LIBBC) \$(OBJ)"
default_target="\$(LIBBC)"
tests="test_library"
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
install_prereqs=" install_library"
uninstall_prereqs=" uninstall_library"
@@ -1040,6 +1292,10 @@ elif [ "$bc_only" -eq 1 ]; then
executables="bc"
dc_test="@printf 'No dc tests to run\\\\n'"
dc_test_np="@printf 'No dc tests to run\\\\n'"
test_dc_history_prereqs=" test_dc_history_skip"
install_prereqs=" install_execs"
install_man_prereqs=" install_bc_manpage"
uninstall_prereqs=" uninstall_bc"
@@ -1047,6 +1303,7 @@ elif [ "$bc_only" -eq 1 ]; then
default_target="\$(BC_EXEC)"
second_target="\$(DC_EXEC)"
tests="test_bc timeconst"
elif [ "$dc_only" -eq 1 ]; then
@@ -1061,19 +1318,36 @@ elif [ "$dc_only" -eq 1 ]; then
main_exec="DC"
executable="DC_EXEC"
bc_test="@printf 'No bc tests to run\\\\n'"
bc_test_np="@printf 'No bc tests to run\\\\n'"
test_bc_history_prereqs=" test_bc_history_skip"
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
install_prereqs=" install_execs"
install_man_prereqs=" install_dc_manpage"
uninstall_prereqs=" uninstall_dc"
uninstall_man_prereqs=" uninstall_dc_manpage"
else
tests="test_dc"
elif [ "$ossfuzz" -eq 1 ]; then
if [ "$bc_only" -ne 0 ] || [ "$dc_only" -ne 0 ]; then
usage "An OSS-Fuzz build must build both fuzzers."
fi
bc=1
dc=1
executables="bc and dc"
# Expressions *cannot* exit in an OSS-Fuzz build.
bc_default_expr_exit=0
dc_default_expr_exit=0
executables="bc_fuzzer and dc_fuzzer"
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
if [ "$library" -eq 0 ]; then
install_prereqs=" install_execs"
@@ -1085,6 +1359,38 @@ else
install_man_prereqs=" install_bcl_manpage"
uninstall_prereqs=" uninstall_library uninstall_bcl_header"
uninstall_man_prereqs=" uninstall_bcl_manpage"
tests="test_library"
fi
second_target_prereqs="src/bc_fuzzer.o $default_target_prereqs"
default_target_prereqs="\$(BC_FUZZER) src/dc_fuzzer.o $default_target_prereqs"
default_target_cmd="\$(CXX) \$(CFLAGS) src/dc_fuzzer.o \$(LIB_FUZZING_ENGINE) \$(OBJS) \$(LDFLAGS) -o \$(DC_FUZZER) \&\& ln -sf ./dc_fuzzer_c \$(DC_FUZZER_C)"
second_target_cmd="\$(CXX) \$(CFLAGS) src/bc_fuzzer.o \$(LIB_FUZZING_ENGINE) \$(OBJS) \$(LDFLAGS) -o \$(BC_FUZZER) \&\& ln -sf ./bc_fuzzer_c \$(BC_FUZZER_C)"
default_target="\$(DC_FUZZER) \$(DC_FUZZER_C)"
second_target="\$(BC_FUZZER) \$(BC_FUZZER_C)"
else
bc=1
dc=1
executables="bc and dc"
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
if [ "$library" -eq 0 ]; then
install_prereqs=" install_execs"
install_man_prereqs=" install_bc_manpage install_dc_manpage"
uninstall_prereqs=" uninstall_bc uninstall_dc"
uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage"
else
install_prereqs=" install_library install_bcl_header"
install_man_prereqs=" install_bcl_manpage"
uninstall_prereqs=" uninstall_library uninstall_bcl_header"
uninstall_man_prereqs=" uninstall_bcl_manpage"
tests="test_library"
fi
second_target_prereqs="$default_target_prereqs"
@@ -1093,6 +1399,18 @@ else
fi
if [ "$fuzz" -ne 0 ] && [ "$ossfuzz" -ne 0 ]; then
usage "Fuzzing mode and OSS-Fuzz mode are mutually exclusive"
fi
# We need specific stuff for fuzzing.
if [ "$fuzz" -ne 0 ] || [ "$ossfuzz" -ne 0 ]; then
debug=1
hist=0
nls=0
optimization="3"
fi
# This sets some necessary things for debug mode.
if [ "$debug" -eq 1 ]; then
@@ -1111,6 +1429,26 @@ if [ -n "$optimization" ]; then
CFLAGS="-O$optimization $CFLAGS"
fi
# Set test coverage defaults.
if [ "$coverage" -eq 1 ]; then
if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
usage "Can only specify -c without -b or -d"
fi
CFLAGS="-fprofile-arcs -ftest-coverage -g -O0 $CFLAGS"
CPPFLAGS="-DNDEBUG $CPPFLAGS"
COVERAGE_OUTPUT="@gcov -pabcdf \$(GCDA) \$(BC_GCDA) \$(DC_GCDA) \$(HISTORY_GCDA) \$(RAND_GCDA)"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;\$(RM) -f \$(GEN)*.gc*"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;gcovr --exclude-unreachable-branches --exclude-throw-branches --html-details --output index.html"
COVERAGE_PREREQS=" test coverage_output"
else
COVERAGE_OUTPUT="@printf 'Coverage not generated\\\\n'"
COVERAGE_PREREQS=""
fi
# Set some defaults.
if [ -z "${DESTDIR+set}" ]; then
destdir=""
@@ -1229,7 +1567,7 @@ if [ "$nls" -ne 0 ]; then
printf 'NLS works.\n\n'
printf 'Testing gencat...\n'
gencat "./en_US.cat" "$scriptdir/locales/en_US.msg" 2>&1
gencat "./en_US.cat" "$scriptdir/locales/en_US.msg" > /dev/null
err="$?"
@@ -1334,10 +1672,26 @@ else
fi
if [ "$hist" -eq 0 ]; then
# We have to disable the history tests if it is disabled or valgrind is on. Or
# if we are using editline or readline.
if [ "$hist" -eq 0 ] || [ "$vg" -ne 0 ]; then
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
history_tests="@printf 'Skipping history tests...\\\\n'"
CFLAGS="$CFLAGS -DBC_ENABLE_EDITLINE=0 -DBC_ENABLE_READLINE=0"
else
if [ "$editline" -eq 0 ] && [ "$readline" -eq 0 ]; then
history_tests="@printf '\$(TEST_STARS)\\\\n\\\\nRunning history tests...\\\\n\\\\n'"
history_tests="$history_tests \&\& \$(TESTSDIR)/history.sh bc -a \&\&"
history_tests="$history_tests \$(TESTSDIR)/history.sh dc -a \&\& printf"
history_tests="$history_tests '\\\\nAll history tests passed.\\\\n\\\\n\$(TEST_STARS)\\\\n'"
else
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
history_tests="@printf 'Skipping history tests...\\\\n'"
fi
# We are also setting the CFLAGS and LDFLAGS here.
if [ "$editline" -ne 0 ]; then
LDFLAGS="$LDFLAGS -ledit"
@@ -1441,7 +1795,7 @@ GEN_DIR="$scriptdir/gen"
# `gen/strgen.sh` is used.
GEN="strgen"
GEN_EXEC_TARGET="\$(HOSTCC) -DBC_ENABLE_AFL=0 -DBC_ENABLE_OSSFUZZ=0 -I$scriptdir/include/ \$(HOSTCFLAGS) -o \$(GEN_EXEC) \$(GEN_C)"
CLEAN_PREREQS=" clean_gen"
CLEAN_PREREQS=" clean_gen clean_coverage"
if [ -z "${GEN_HOST+set}" ]; then
GEN_HOST=1
@@ -1449,6 +1803,7 @@ else
if [ "$GEN_HOST" -eq 0 ]; then
GEN="strgen.sh"
GEN_EXEC_TARGET="@printf 'Do not need to build gen/strgen.c\\\\n'"
CLEAN_PREREQS=" clean_coverage"
fi
fi
@@ -1493,7 +1848,9 @@ else
headers="$headers \$(DC_HEADERS)"
fi
version=$(cat "$scriptdir/VERSION.txt" | head -n1)
# This convoluted mess does pull the version out. If you change the format of
# include/version.h, you may have to change this line.
version=$(cat "$scriptdir/include/version.h" | grep "VERSION " - | awk '{ print $3 }' -)
if [ "$library" -ne 0 ]; then
@@ -1523,6 +1880,14 @@ if [ "$library" -ne 0 ]; then
fi
elif [ "$ossfuzz" -ne 0 ]; then
unneeded="$unneeded library.c main.c"
PC_PATH=""
pkg_config_install=""
pkg_config_uninstall=""
else
unneeded="$unneeded library.c"
@@ -1544,6 +1909,10 @@ if [ "$manpage_args" = "" ]; then
manpage_args="A"
fi
if [ "$vg" -ne 0 ] || [ "$ossfuzz" -ne 0 ]; then
memcheck=1
fi
if [ "$bc_default_prompt" = "" ]; then
bc_default_prompt="$bc_default_tty_mode"
fi
@@ -1552,6 +1921,14 @@ if [ "$dc_default_prompt" = "" ]; then
dc_default_prompt="$dc_default_tty_mode"
fi
# Generate the test targets and prerequisites.
bc_tests=$(gen_std_test_targets bc)
bc_script_tests=$(gen_script_test_targets bc)
bc_err_tests=$(gen_err_test_targets bc)
dc_tests=$(gen_std_test_targets dc)
dc_script_tests=$(gen_script_test_targets dc)
dc_err_tests=$(gen_err_test_targets dc)
printf 'unneeded: %s\n' "$unneeded"
# Print out the values; this is for debugging.
@@ -1572,6 +1949,7 @@ printf 'BC_ENABLE_LIBRARY=%s\n\n' "$library"
printf 'BC_ENABLE_HISTORY=%s\n' "$hist"
printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math"
printf 'BC_ENABLE_NLS=%s\n\n' "$nls"
printf 'BC_ENABLE_AFL=%s\n' "$fuzz"
printf '\n'
printf 'BC_NUM_KARATSUBA_LEN=%s\n' "$karatsuba_len"
printf '\n'
@@ -1668,11 +2046,26 @@ contents=$(replace "$contents" "BUILDDIR" "$builddir")
contents=$(replace "$contents" "HEADERS" "$headers")
contents=$(replace "$contents" "VERSION" "$version")
contents=$(replace "$contents" "BC_ENABLED" "$bc")
contents=$(replace "$contents" "DC_ENABLED" "$dc")
contents=$(replace "$contents" "BC_ALL_TESTS" "$bc_test")
contents=$(replace "$contents" "BC_ALL_TESTS_NP" "$bc_test_np")
contents=$(replace "$contents" "BC_TESTS" "$bc_tests")
contents=$(replace "$contents" "BC_SCRIPT_TESTS" "$bc_script_tests")
contents=$(replace "$contents" "BC_ERROR_TESTS" "$bc_err_tests")
contents=$(replace "$contents" "BC_TEST_EXEC" "$bc_test_exec")
contents=$(replace "$contents" "TIMECONST_ALL_TESTS" "$timeconst")
contents=$(replace "$contents" "DC_ALL_TESTS" "$dc_test")
contents=$(replace "$contents" "DC_ALL_TESTS_NP" "$dc_test_np")
contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
contents=$(replace "$contents" "DC_ERROR_TESTS" "$dc_err_tests")
contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
contents=$(replace "$contents" "BCL_TEST_EXEC" "$bcl_test_exec")
contents=$(replace "$contents" "BUILD_TYPE" "$manpage_args")
contents=$(replace "$contents" "EXCLUDE_EXTRA_MATH" "$exclude_extra_math")
@@ -1680,6 +2073,10 @@ contents=$(replace "$contents" "LIBRARY" "$library")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")
contents=$(replace "$contents" "NLS" "$nls")
contents=$(replace "$contents" "FUZZ" "$fuzz")
contents=$(replace "$contents" "OSSFUZZ" "$ossfuzz")
contents=$(replace "$contents" "MEMCHECK" "$memcheck")
contents=$(replace "$contents" "LIB_FUZZING_ENGINE" "$LIB_FUZZING_ENGINE")
contents=$(replace "$contents" "BC_LIB_O" "$bc_lib")
contents=$(replace "$contents" "BC_HELP_O" "$bc_help")
@@ -1702,6 +2099,8 @@ contents=$(replace "$contents" "CPPFLAGS" "$CPPFLAGS")
contents=$(replace "$contents" "LDFLAGS" "$LDFLAGS")
contents=$(replace "$contents" "CC" "$CC")
contents=$(replace "$contents" "HOSTCC" "$HOSTCC")
contents=$(replace "$contents" "COVERAGE_OUTPUT" "$COVERAGE_OUTPUT")
contents=$(replace "$contents" "COVERAGE_PREREQS" "$COVERAGE_PREREQS")
contents=$(replace "$contents" "INSTALL_PREREQS" "$install_prereqs")
contents=$(replace "$contents" "INSTALL_MAN_PREREQS" "$install_man_prereqs")
contents=$(replace "$contents" "INSTALL_LOCALES" "$install_locales")
@@ -1727,14 +2126,22 @@ contents=$(replace "$contents" "BC_EXEC_CMD" "$bc_exec_cmd")
contents=$(replace "$contents" "DC_EXEC_PREREQ" "$dc_exec_prereq")
contents=$(replace "$contents" "DC_EXEC_CMD" "$dc_exec_cmd")
contents=$(replace "$contents" "GENERATE_TESTS" "$generate_tests")
contents=$(replace "$contents" "PROBLEMATIC_TESTS" "$problematic_tests")
contents=$(replace "$contents" "EXECUTABLES" "$executables")
contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
contents=$(replace "$contents" "EXEC" "$executable")
contents=$(replace "$contents" "TESTS" "$tests")
contents=$(replace "$contents" "BC_HISTORY_TEST_PREREQS" "$test_bc_history_prereqs")
contents=$(replace "$contents" "DC_HISTORY_TEST_PREREQS" "$test_dc_history_prereqs")
contents=$(replace "$contents" "HISTORY_TESTS" "$history_tests")
contents=$(replace "$contents" "VG_BC_TEST" "$vg_bc_test")
contents=$(replace "$contents" "VG_DC_TEST" "$vg_dc_test")
contents=$(replace "$contents" "TIMECONST" "$timeconst")
contents=$(replace "$contents" "KARATSUBA" "$karatsuba")
contents=$(replace "$contents" "KARATSUBA_TEST" "$karatsuba_test")
contents=$(replace "$contents" "LONG_BIT_DEFINE" "$LONG_BIT_DEFINE")
@@ -1762,6 +2169,28 @@ contents=$(replace "$contents" "DC_DEFAULT_DIGIT_CLAMP" "$dc_default_digit_clamp
# Do the first print to the Makefile.
printf '%s\n%s\n\n' "$contents" "$SRC_TARGETS" > "Makefile"
# Generate the individual test targets.
if [ "$bc" -ne 0 ]; then
gen_std_tests bc "$extra_math" "$time_tests" $bc_test_exec
gen_script_tests bc "$extra_math" "$generate_tests" "$time_tests" $bc_test_exec
gen_err_tests bc $bc_test_exec
fi
if [ "$dc" -ne 0 ]; then
gen_std_tests dc "$extra_math" "$time_tests" $dc_test_exec
gen_script_tests dc "$extra_math" "$generate_tests" "$time_tests" $dc_test_exec
gen_err_tests dc $dc_test_exec
fi
if [ "$ossfuzz" -ne 0 ]; then
printf 'bc_fuzzer_c: $(BC_FUZZER)\n\tln -sf $(BC_FUZZER) bc_fuzzer_c\n' >> Makefile
printf 'bc_fuzzer_C: $(BC_FUZZER)\n\tln -sf $(BC_FUZZER) bc_fuzzer_C\n' >> Makefile
printf 'dc_fuzzer_c: $(DC_FUZZER)\n\tln -sf $(DC_FUZZER) dc_fuzzer_c\n' >> Makefile
printf 'dc_fuzzer_C: $(DC_FUZZER)\n\tln -sf $(DC_FUZZER) dc_fuzzer_C\n' >> Makefile
fi
# Copy the correct manuals to the expected places.
mkdir -p manuals
cp -f "$scriptdir/manuals/bc/$manpage_args.1.md" manuals/bc.1.md
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
bc is a command-line, arbitrary-precision calculator with a Turing-complete
language. For details, use `man %s` or see the online documentation at
https://github.com/gavinhoward/bc/tree/%s/manuals/bc/%s.1.md .
https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
dc is a reverse-polish notation command-line calculator which supports unlimited
precision arithmetic. For details, use `man %s` or see the online documentation
at https://github.com/gavinhoward/bc/tree/%s/manuals/dc/%s.1.md .
at https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This dc is (mostly) compatible with the OpenBSD dc and the GNU dc. See the
OpenBSD man page (http://man.openbsd.org/OpenBSD-current/man1/dc.1) and the GNU
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+87 -62
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -444,77 +444,108 @@ define void uint64(x){uintn(x,8)}
define void int64(x){intn(x,8)}
define void uint(x){uintn(x,ubytes(x))}
define void int(x){intn(x,sbytes(x))}
define bunrev(t){
auto a,s,m[]
s=scale
scale=0
t=abs(t)$
while(t!=1){
t=divmod(t,2,m[])
a*=2
a+=m[0]
}
scale=s
return a
}
define band(a,b){
auto r,p,s,m[]
auto s,t,m[],n[]
a=abs(a)$
b=abs(b)$
r=0
p=1
s=scale
scale=0
while(a&&b) {
a=divmod(a,2,m[])
if(m[0]){
b=divmod(b,2,m[])
if(m[0])r+=p
}else b/=2
p*=2
if(b>a){
t=b
b=a
a=t
}
scale=s
return r
}
define bor(a,b){
auto r,p,s,m[]
a=abs(a)$
b=abs(b)$
r=0
p=1
s=scale
scale=0
while(a||b){
a=divmod(a,2,m[])
if(!m[0])b=divmod(b,2,m[])
else b/=2
if(m[0])r+=p
p*=2
}
scale=s
return r
}
define bxor(a,b){
auto r,p,s,m[],n[]
a=abs(a)$
b=abs(b)$
r=0
p=1
s=scale
scale=0
while(a||b){
t=1
while(b){
a=divmod(a,2,m[])
b=divmod(b,2,n[])
if(m[0]+n[0]==1)r+=p
p*=2
t*=2
t+=(m[0]&&n[0])
}
scale=s
return r
return bunrev(t)
}
define bor(a,b){
auto s,t,m[],n[]
a=abs(a)$
b=abs(b)$
if(b>a){
t=b
b=a
a=t
}
s=scale
scale=0
t=1
while(b){
a=divmod(a,2,m[])
b=divmod(b,2,n[])
t*=2
t+=(m[0]||n[0])
}
while(a){
a=divmod(a,2,m[])
t*=2
t+=m[0]
}
scale=s
return bunrev(t)
}
define bxor(a,b){
auto s,t,m[],n[]
a=abs(a)$
b=abs(b)$
if(b>a){
t=b
b=a
a=t
}
s=scale
scale=0
t=1
while(b){
a=divmod(a,2,m[])
b=divmod(b,2,n[])
t*=2
t+=(m[0]+n[0]==1)
}
while(a){
a=divmod(a,2,m[])
t*=2
t+=m[0]
}
scale=s
return bunrev(t)
}
define bshl(a,b){return abs(a)$*2^abs(b)$}
define bshr(a,b){return(abs(a)$/2^abs(b)$)$}
define bnotn(x,n){
auto r,p,s,t,m[]
auto s,t,m[]
s=scale
scale=0
r=2^(abs(n)$*8)
x=abs(x)$%r+r
r=0
p=1
t=2^(abs(n)$*8)
x=abs(x)$%t+t
t=1
while(x!=1){
x=divmod(x,2,m[])
if(!m[0])r+=p
p*=2
t*=2
t+=!m[0]
}
scale=s
return r
return bunrev(t)
}
define bnot8(x){return bnotn(x,1)}
define bnot16(x){return bnotn(x,2)}
@@ -522,19 +553,13 @@ define bnot32(x){return bnotn(x,4)}
define bnot64(x){return bnotn(x,8)}
define bnot(x){return bnotn(x,ubytes(x))}
define brevn(x,n){
auto a,s,m[]
auto s,t,m[]
s=scale
scale=0
a=2^(abs(n)$*8)
x=abs(x)$%a+a
a=0
while(x!=1){
x=divmod(x,2,m[])
a*=2
a+=m[0]
}
t=2^(abs(n)$*8)
x=abs(x)$%t+t
scale=s
return a
return bunrev(x)
}
define brev8(x){return brevn(x,1)}
define brev16(x){return brevn(x,2)}
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -68,7 +68,7 @@ static const char* const bc_gen_ex_end = "{{ end }}";
// This is exactly what it looks like. It just slaps a simple license header on
// the generated C source file.
static const char* const bc_gen_header =
"// Copyright (c) 2018-2025 Gavin D. Howard and contributors.\n"
"// Copyright (c) 2018-2024 Gavin D. Howard and contributors.\n"
"// Licensed under the 2-clause BSD license.\n"
"// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n";
// clang-format on
+2 -2
View File
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -96,7 +96,7 @@ if [ -n "$remove_tabs" ]; then
fi
cat<<EOF
// Copyright (c) 2018-2025 Gavin D. Howard and contributors.
// Copyright (c) 2018-2024 Gavin D. Howard and contributors.
// Licensed under the 2-clause BSD license.
// *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. ***
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+4 -4
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -265,9 +265,9 @@ bc_lex_token(BcLex* l);
* @return An expression entry for bc_parse_exprs[].
*/
#define BC_PARSE_EXPR_ENTRY(e1, e2, e3, e4, e5, e6, e7, e8) \
((UINT8_C(e1) << 7) | (UINT8_C(e2) << 6) | (UINT8_C(e3) << 5) | \
(UINT8_C(e4) << 4) | (UINT8_C(e5) << 3) | (UINT8_C(e6) << 2) | \
(UINT8_C(e7) << 1) | (UINT8_C(e8) << 0))
((UINTMAX_C(e1) << 7) | (UINTMAX_C(e2) << 6) | (UINTMAX_C(e3) << 5) | \
(UINTMAX_C(e4) << 4) | (UINTMAX_C(e5) << 3) | (UINTMAX_C(e6) << 2) | \
(UINTMAX_C(e7) << 1) | (UINTMAX_C(e8) << 0))
/**
* Returns true if token @a i is a token that belongs in an expression.
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+25 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -120,6 +120,30 @@ typedef struct BcHistory
extern const char bc_history_editrc[];
extern const size_t bc_history_editrc_len;
#ifdef __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && ((len) == -1 || errno == EINTR))
#else // __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && (len) == -1 && errno == EINTR)
#endif // __APPLE__
#else // BC_ENABLE_EDITLINE
#if BC_ENABLE_READLINE
+1 -5
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -533,10 +533,6 @@ typedef enum BcType
} BcType;
#if BC_ENABLED
/// Check if type array or array reference
#define BC_IS_ARRAY(e) (e == BC_TYPE_ARRAY || e == BC_TYPE_REF)
/// An auto variable in bc.
typedef struct BcAuto
{
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+4 -12
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -145,9 +145,6 @@ typedef struct BcProgram
#endif // BC_ENABLED
/// The number of results that have not been retired.
size_t nresults;
// The BcDig array for strmb. This uses BC_NUM_LONG_LOG10 because it is used
// in bc_num_ulong2num(), which attempts to realloc, unless it is big
// enough. This is big enough.
@@ -210,16 +207,11 @@ typedef struct BcProgram
* operands while preserving the result (which we assumed was pushed before the
* actual operation).
* @param p The program.
* @param nres The number of results returned by the instruction.
* @param nops The number of operands used by the instruction.
*/
#define bc_program_retire(p, nops) \
do \
{ \
bc_vec_npopAt(&(p)->results, (nops), \
(p)->results.len - ((p)->nresults + nops)); \
p->nresults = 0; \
} \
while (0)
#define bc_program_retire(p, nres, nops) \
(bc_vec_npopAt(&(p)->results, (nops), (p)->results.len - (nres + nops)))
#if DC_ENABLED
+1 -1
View File
@@ -13,7 +13,7 @@
* This code is under the following license:
*
* Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+6 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -683,7 +683,12 @@ typedef enum BcMode
#define BC_NO_SIG_EXC(vm) \
BC_LIKELY((vm)->status == (sig_atomic_t) BC_STATUS_SUCCESS && !(vm)->sig)
#ifndef _WIN32
#define BC_SIG_INTERRUPT(vm) \
BC_UNLIKELY((vm)->sig != 0 && (vm)->sig != SIGWINCH)
#else // _WIN32
#define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0)
#endif // _WIN32
#if BC_DEBUG
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+42
View File
@@ -0,0 +1,42 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The version of bc.
*
*/
#ifndef BC_VERSION_H
#define BC_VERSION_H
/// The current version.
#define VERSION 7.0.2
#endif // BC_VERSION_H
+2 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -52,6 +52,7 @@
#endif // BC_ENABLE_NLS
#include <version.h>
#include <status.h>
#include <num.h>
#include <lex.h>
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+13 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -2109,6 +2109,17 @@ If you want to a use signed two\[cq]s complement argument, use
\f[B]s2u(x)\f[R] to convert.
.RE
.TP
\f[B]bunrev(t)\f[R]
Assumes \f[B]t\f[R] is a bitwise\-reversed number with an extra set bit
one place more significant than the real most significant bit (which was
the least significant bit in the original number).
This number is reversed and returned without the extra set bit.
.RS
.PP
This function is used to implement other bitwise functions; it is not
meant to be used by users, but it can be.
.RE
.TP
\f[B]plz(x)\f[R]
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that
\f[B]\-1\f[R] and less than \f[B]1\f[R], it is printed with a leading
@@ -2932,7 +2943,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+12 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1766,6 +1766,16 @@ The extended library is a **non-portable extension**.
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
**bunrev(t)**
: Assumes **t** is a bitwise-reversed number with an extra set bit one place
more significant than the real most significant bit (which was the least
significant bit in the original number). This number is reversed and
returned without the extra set bit.
This function is used to implement other bitwise functions; it is not meant
to be used by users, but it can be.
**plz(x)**
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
@@ -2511,7 +2521,7 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+2 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -1758,7 +1758,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+2 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1509,7 +1509,7 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+2 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -1731,7 +1731,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+2 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1483,7 +1483,7 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+2 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -1725,7 +1725,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+2 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1475,7 +1475,7 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+2 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -1752,7 +1752,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+2 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1501,7 +1501,7 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+13 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -2109,6 +2109,17 @@ If you want to a use signed two\[cq]s complement argument, use
\f[B]s2u(x)\f[R] to convert.
.RE
.TP
\f[B]bunrev(t)\f[R]
Assumes \f[B]t\f[R] is a bitwise\-reversed number with an extra set bit
one place more significant than the real most significant bit (which was
the least significant bit in the original number).
This number is reversed and returned without the extra set bit.
.RS
.PP
This function is used to implement other bitwise functions; it is not
meant to be used by users, but it can be.
.RE
.TP
\f[B]plz(x)\f[R]
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that
\f[B]\-1\f[R] and less than \f[B]1\f[R], it is printed with a leading
@@ -2905,7 +2916,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+12 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1766,6 +1766,16 @@ The extended library is a **non-portable extension**.
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
**bunrev(t)**
: Assumes **t** is a bitwise-reversed number with an extra set bit one place
more significant than the real most significant bit (which was the least
significant bit in the original number). This number is reversed and
returned without the extra set bit.
This function is used to implement other bitwise functions; it is not meant
to be used by users, but it can be.
**plz(x)**
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
@@ -2485,7 +2495,7 @@ This bc(1) supports error messages for different locales, and thus, it supports
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+13 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -2109,6 +2109,17 @@ If you want to a use signed two\[cq]s complement argument, use
\f[B]s2u(x)\f[R] to convert.
.RE
.TP
\f[B]bunrev(t)\f[R]
Assumes \f[B]t\f[R] is a bitwise\-reversed number with an extra set bit
one place more significant than the real most significant bit (which was
the least significant bit in the original number).
This number is reversed and returned without the extra set bit.
.RS
.PP
This function is used to implement other bitwise functions; it is not
meant to be used by users, but it can be.
.RE
.TP
\f[B]plz(x)\f[R]
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that
\f[B]\-1\f[R] and less than \f[B]1\f[R], it is printed with a leading
@@ -2899,7 +2910,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
+12 -2
View File
@@ -2,7 +2,7 @@
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2018-2025 Gavin D. Howard and contributors.
Copyright (c) 2018-2024 Gavin D. Howard and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -1766,6 +1766,16 @@ The extended library is a **non-portable extension**.
If you want to a use signed two's complement argument, use **s2u(x)** to
convert.
**bunrev(t)**
: Assumes **t** is a bitwise-reversed number with an extra set bit one place
more significant than the real most significant bit (which was the least
significant bit in the original number). This number is reversed and
returned without the extra set bit.
This function is used to implement other bitwise functions; it is not meant
to be used by users, but it can be.
**plz(x)**
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
@@ -2477,7 +2487,7 @@ use a period (**.**) as a radix point, regardless of the value of
Before version **6.1.0**, this bc(1) had incorrect behavior for the **quit**
statement.
No other bugs are known. Report bugs at https://github.com/gavinhoward/bc .
No other bugs are known. Report bugs at https://git.gavinhoward.com/gavin/bc .
# AUTHORS
+13 -2
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -2109,6 +2109,17 @@ If you want to a use signed two\[cq]s complement argument, use
\f[B]s2u(x)\f[R] to convert.
.RE
.TP
\f[B]bunrev(t)\f[R]
Assumes \f[B]t\f[R] is a bitwise\-reversed number with an extra set bit
one place more significant than the real most significant bit (which was
the least significant bit in the original number).
This number is reversed and returned without the extra set bit.
.RS
.PP
This function is used to implement other bitwise functions; it is not
meant to be used by users, but it can be.
.RE
.TP
\f[B]plz(x)\f[R]
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that
\f[B]\-1\f[R] and less than \f[B]1\f[R], it is printed with a leading
@@ -2926,7 +2937,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://github.com/gavinhoward/bc .
Report bugs at https://git.gavinhoward.com/gavin/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
Loaded 100 of 3038 files, more files were not shown because too many files have changed in this diff. Show more