~nabijaczleweli/voreutils

72087d46a1d3f95f4e58bc8d4803aa05ab64b9f0 — наб a month ago e1ceab8
OpenBSD port
5 files changed, 13 insertions(+), 5 deletions(-)

M cmd/dd.cpp
M cmd/head.cpp
M cmd/tee.cpp
M cmd/wc.cpp
M man/expr.1
M cmd/dd.cpp => cmd/dd.cpp +1 -1
@@ 524,7 524,7 @@ int main(int, const char * const * argv) {
	auto append_writebuf = [&](auto beg, auto end) {
		auto ret = true;
		while(ret && static_cast<std::size_t>((end - beg) + (buffer_out_cur - buffer_out)) >= obs) {
			const auto ichunk         = std::min(obs - static_cast<std::size_t>(buffer_out_cur - buffer_out), static_cast<std::size_t>(end - beg));
			const auto ichunk         = std::min(static_cast<std::size_t>(obs - (buffer_out_cur - buffer_out)), static_cast<std::size_t>(end - beg));
			const struct iovec iovs[] = {{buffer_out, static_cast<std::size_t>(buffer_out_cur - buffer_out)}, {beg, ichunk}};
			ret                       = commit_write(std::begin(iovs), std::end(iovs));
			buffer_out_cur            = buffer_out;

M cmd/head.cpp => cmd/head.cpp +1 -1
@@ 166,7 166,7 @@ int main(int argc, char * const * argv) {
				char buf[64 * 1024];
				if(!except) {
					auto left = count;
					for(ssize_t rd; left && (rd = read_all(fd, buf, std::min(sizeof(buf), left)));) {
					for(ssize_t rd; left && (rd = read_all(fd, buf, std::min(static_cast<std::uint64_t>(sizeof(buf)), left)));) {
						left -= rd;

						if(!write_all(buf, buf + rd))

M cmd/tee.cpp => cmd/tee.cpp +1 -1
@@ 77,7 77,7 @@ int main(int argc, char * const * argv) {
			return false;
		};

		if(int stdout = 1; commit_write("stdout", stdout, true))
		if(int stdout_ = 1; commit_write("stdout", stdout_, true))
			return 1;
		for(auto && [path, fd] : files)
			if(commit_write(path, fd, fatal_errors))

M cmd/wc.cpp => cmd/wc.cpp +9 -1
@@ 40,7 40,10 @@ sys     0m0.456s
#if __has_include(<linux/fs.h>)  // Linux
#include <linux/fs.h>
#endif
#if __has_include(<sys/disk.h>)  // NetBSD, FreeBSD, Illumos
#if __OpenBSD__
#include <sys/disklabel.h>
#include <sys/dkio.h>
#elif __has_include(<sys/disk.h>)  // NetBSD, FreeBSD, Illumos
#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/types.h>


@@ 140,7 143,12 @@ int main(int argc, char * const * argv) {
				off_t sz;
#endif
				ret = ioctl(fd, DIOCGMEDIASIZE, &sz);
#elif __OpenBSD__
				struct disklabel dl;
				auto & sz = dl.d_secsize;
				ret       = ioctl(fd, DIOCGDINFO, &dl);
#endif

				if(ret != -1) {
					acc.bytes = sz;
					done      = true;

M man/expr.1 => man/expr.1 +1 -1
@@ 305,7 305,7 @@ if not nullary and
otherwise
.Pq with no Sy 0 Ns -folding ,
but the global behaviour is described as
.D1 Note that Sy 0 No is returned to indicate a zero value, rather than the null string.
.D1 Note that Sy 0 No is returned to indicate a zero value, rather than the null string .
The present-day behaviour matches and falls out of this.
The comparison operators for non-integers are byte-wise, owing to no system localisation.
.Cm \&: