Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package bitwise for openSUSE:Factory checked in at 2021-11-02 19:19:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bitwise (Old) and /work/SRC/openSUSE:Factory/.bitwise.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bitwise" Tue Nov 2 19:19:11 2021 rev:3 rq:928788 version:0.43 Changes: -------- --- /work/SRC/openSUSE:Factory/bitwise/bitwise.changes 2021-04-22 18:06:20.254731715 +0200 +++ /work/SRC/openSUSE:Factory/.bitwise.new.1890/bitwise.changes 2021-11-02 19:19:52.191116422 +0100 @@ -1,0 +2,7 @@ +Mon Nov 1 09:28:54 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 0.43 + * Add support for IPv4 parsing and output in command line mode + * Fix compiler warnings + +------------------------------------------------------------------- Old: ---- bitwise-0.42.tar.gz New: ---- bitwise-0.43.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bitwise.spec ++++++ --- /var/tmp/diff_new_pack.K3Uigu/_old 2021-11-02 19:19:52.551116698 +0100 +++ /var/tmp/diff_new_pack.K3Uigu/_new 2021-11-02 19:19:52.555116701 +0100 @@ -18,7 +18,7 @@ Name: bitwise -Version: 0.42 +Version: 0.43 Release: 0 Summary: Interactive bitwise operation in ncurses License: GPL-3.0-or-later ++++++ bitwise-0.42.tar.gz -> bitwise-0.43.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/.github/workflows/build-osx.yaml new/bitwise-0.43/.github/workflows/build-osx.yaml --- old/bitwise-0.42/.github/workflows/build-osx.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/bitwise-0.43/.github/workflows/build-osx.yaml 2021-11-01 10:16:20.000000000 +0100 @@ -0,0 +1,27 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + env: + LDFLAGS: "-L/usr/local/opt/readline/lib" + CPPFLAGS: "-I/usr/local/opt/readline/include" + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - name: Install lib-cunit + run: brew install readline cunit autoconf automake + - name: Bootstrap + run: ./bootstrap.sh + - name: configure + run: ./configure + - name: make check + run: make check + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/.github/workflows/c-cpp.yml new/bitwise-0.43/.github/workflows/c-cpp.yml --- old/bitwise-0.42/.github/workflows/c-cpp.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/bitwise-0.43/.github/workflows/c-cpp.yml 2021-11-01 10:16:20.000000000 +0100 @@ -0,0 +1,24 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install xmllint + run: sudo apt-get install libcunit1-dev + - name: Bootstrap + run: ./bootstrap.sh + - name: configure + run: ./configure --enable-gcov + - name: make check + run: make check + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/README.md new/bitwise-0.43/README.md --- old/bitwise-0.42/README.md 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/README.md 2021-11-01 10:16:20.000000000 +0100 @@ -29,6 +29,8 @@ _bitwise_ detects the base by the preface of the input (_0x/0X_ for hexadecimal, leading _0_ for octal, _b_ for binary, and the rest is decimal). +**NEW** Bitwise now support parsing IPv4 addresses, it will also output the possible IPv4 address in both Network and reveresed byte order. + ### Examples: #### Simple base conversion @@ -145,6 +147,11 @@ ### Windows NCurses doesn't support windows. You can use the windows subsystem for Linux as a workaround. +### Nix +``` +nix-env -i bitwise +``` + ### Building from source #### Prerequisites diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/bitwise.1 new/bitwise-0.43/bitwise.1 --- old/bitwise-0.42/bitwise.1 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/bitwise.1 2021-11-01 10:16:20.000000000 +0100 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH BITWISE "1" "April 2021" "bitwise v0.42" "User Commands" +.TH BITWISE "1" "November 2021" "bitwise v0.43" "User Commands" .SH NAME bitwise \- Terminal based bit manipulator in ncurses .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/configure.ac new/bitwise-0.43/configure.ac --- old/bitwise-0.42/configure.ac 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/configure.ac 2021-11-01 10:16:20.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([bitwise], [v0.42], [rfried....@gmail.com]) +AC_INIT([bitwise], [v0.43], [rfried....@gmail.com]) AC_CONFIG_SRCDIR([src/misc.c]) AC_CONFIG_HEADERS([inc/config.h]) @@ -32,6 +32,9 @@ # Checks for header files. AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdlib.h string.h curses.h form.h]) +AC_CHECK_DECLS([bswap_32], [], [], [[#include <byteswap.h>]]) +AM_CONDITIONAL(HAVE_BYTESWAP_H, [test "x$ac_cv_have_decl_bswap_32" = "xyes"]) + # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_HEADER_STDBOOL AC_TYPE_UINT64_T diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/src/interactive.c new/bitwise-0.43/src/interactive.c --- old/bitwise-0.42/src/interactive.c 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/src/interactive.c 2021-11-01 10:16:20.000000000 +0100 @@ -114,7 +114,7 @@ break; } - mvwprintw(history_win, j, 2, history[history_pos - i].line); + mvwprintw(history_win, j, 2, "%s", history[history_pos - i].line); } if (g_has_color) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/src/main.c new/bitwise-0.43/src/main.c --- old/bitwise-0.42/src/main.c 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/src/main.c 2021-11-01 10:16:20.000000000 +0100 @@ -8,6 +8,18 @@ #include <stdint.h> #include <getopt.h> #include <locale.h> +#include <arpa/inet.h> +#include <limits.h> + +#ifdef HAVE_DECL_BSWAP_32 +#include <byteswap.h> +#else +#define bswap_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + +#endif + #include "bitwise.h" #include "shunting-yard.h" @@ -18,6 +30,7 @@ char binary[512]; int pos = 0; int i, j; + struct in_addr ip_addr; buf_size[0] = '\0'; sprintf_size(val, buf_size, si); @@ -53,6 +66,15 @@ if (g_width < 64) printf("%sRadix64: %s%s\n", color_green, color_blue, l64a(val)); + if (val >= UINT_MAX) { + printf("%sIPv4: %s%s\n", color_green, color_blue, "Value to big to be a valid IPv4 address"); + } else { + ip_addr.s_addr = val; + printf("%sIPv4 (Network byte order - Big): %s %s\n", color_green, color_blue, inet_ntoa(ip_addr)); + ip_addr.s_addr = bswap_32(val); + printf("%sIPv4 (Reverwsed byte order - Little): %s %s\n", color_green, color_blue, inet_ntoa(ip_addr)); + } + printf("%sASCII: %s", color_green, color_blue); for (i = sizeof(uint64_t) - 1; i >= 0; i--) { char c = ((char *)&val)[i]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/src/misc.c new/bitwise-0.43/src/misc.c --- old/bitwise-0.42/src/misc.c 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/src/misc.c 2021-11-01 10:16:20.000000000 +0100 @@ -190,10 +190,28 @@ return 0; } +int ip_scanf(const char *input, uint64_t *val) +{ + union { + uint8_t ip[4]; + uint32_t ip32; + } ip; + if (sscanf(input, "%hhu.%hhu.%hhu.%hhu", + &ip.ip[0], &ip.ip[1], &ip.ip[2], &ip.ip[3]) != 4) { + fprintf(stderr, "Failed parsing IPv4 address\n"); + return 1; + } + + *val = ip.ip32; + return 0; +} + int parse_input(const char *input, uint64_t *val) { int base; + if (strchr(input, '.')) + return ip_scanf(input, val); if (tolower(input[0]) == 'b') base = 2; else if (input[0] == '0') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bitwise-0.42/tests/test-shunting-yard.c new/bitwise-0.43/tests/test-shunting-yard.c --- old/bitwise-0.42/tests/test-shunting-yard.c 2021-04-16 17:20:13.000000000 +0200 +++ new/bitwise-0.43/tests/test-shunting-yard.c 2021-11-01 10:16:20.000000000 +0100 @@ -29,7 +29,6 @@ ASSERT_RESULT("0x2 + 0b101", 7); ASSERT_RESULT("0b101 + 0x2", 7); ASSERT_RESULT("2 + 2", 4); - ASSERT_RESULT("2+2.", 4); ASSERT_RESULT("3 + (5 + 1 + (2 + 2))", 13); ASSERT_RESULT("1+2+4+8+16 + 11", 42);