~nabijaczleweli/voreutils

9fb91be169acfa9c903917b2000d19e98f4edb5c — наб a month ago 73c57c0
I love integers
2 files changed, 10 insertions(+), 18 deletions(-)

M cmd/head.cpp
M cmd/who.cpp
M cmd/head.cpp => cmd/head.cpp +2 -2
@@ 188,7 188,7 @@ int main(int argc, const char * const * argv) {

#if __linux__  // TODO? also in cat.cpp
					{
						ssize_t rd;
						ssize_t rd{};
						while(left && (rd = splice(fd, NULL, 1, NULL, std::min(128_u64 * 1024_u64 * 1024_u64, left), SPLICE_F_MOVE | SPLICE_F_MORE)) > 0)
							left -= rd;
						if(rd != -1)  // All errors are better-served when detected by the read()/write() loop below


@@ 196,7 196,7 @@ int main(int argc, const char * const * argv) {
					}

					{
						ssize_t rd;
						ssize_t rd{};
						while(left && (rd = copy_file_range(fd, NULL, 1, NULL, std::min(128_u64 * 1024_u64 * 1024_u64, left), 0)) > 0)
							left -= rd;
						if(rd != -1)  // All errors are better-served when detected by the read()/write() loop below

M cmd/who.cpp => cmd/who.cpp +8 -16
@@ 42,22 42,14 @@ using namespace std::literals;
	"       %1$s [-s] [-{T|w}] [-HaIL]  [-ublrpdt] am I\n"


static_assert(USER_PROCESS >= 0);
static_assert(BOOT_TIME >= 0);
static_assert(LOGIN_PROCESS >= 0);
static_assert(RUN_LVL >= 0);
static_assert(DEAD_PROCESS >= 0);
static_assert(INIT_PROCESS >= 0);
static_assert(OLD_TIME >= 0);
static_assert(NEW_TIME >= 0);
static_assert(USER_PROCESS < 16);
static_assert(BOOT_TIME < 16);
static_assert(LOGIN_PROCESS < 16);
static_assert(RUN_LVL < 16);
static_assert(DEAD_PROCESS < 16);
static_assert(INIT_PROCESS < 16);
static_assert(OLD_TIME < 16);
static_assert(NEW_TIME < 16);
static_assert(USER_PROCESS >= 0 && USER_PROCESS < 16);
static_assert(BOOT_TIME >= 0 && BOOT_TIME < 16);
static_assert(LOGIN_PROCESS >= 0 && LOGIN_PROCESS < 16);
static_assert(RUN_LVL >= 0 && RUN_LVL < 16);
static_assert(DEAD_PROCESS >= 0 && DEAD_PROCESS < 16);
static_assert(INIT_PROCESS >= 0 && INIT_PROCESS < 16);
static_assert(OLD_TIME >= 0 && OLD_TIME < 16);
static_assert(NEW_TIME >= 0 && NEW_TIME < 16);
static const constexpr char types_s[]          = {'u', 'b', 'l', 'r', 'p', 'd', 't'};
static const constexpr std::uint16_t types_d[] = {
    1 << USER_PROCESS, 1 << BOOT_TIME, 1 << LOGIN_PROCESS, 1 << RUN_LVL, 1 << INIT_PROCESS, 1 << DEAD_PROCESS, (1 << OLD_TIME) | (1 << NEW_TIME)};