Hello community,

here is the log from the commit of package reveng for openSUSE:Factory checked 
in at 2019-11-06 13:56:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/reveng (Old)
 and      /work/SRC/openSUSE:Factory/.reveng.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "reveng"

Wed Nov  6 13:56:49 2019 rev:5 rq:745174 version:2.0.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/reveng/reveng.changes    2019-05-07 
23:20:59.177195914 +0200
+++ /work/SRC/openSUSE:Factory/.reveng.new.2990/reveng.changes  2019-11-06 
13:56:53.676207453 +0100
@@ -1,0 +2,20 @@
+Sun Nov  3 14:09:22 UTC 2019 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 2.0.2
+  * The memory allocation expands geometrically while reading
+    polynomials from files; this improves performance on large
+    files but memory overhead is increased during the read.
+  * The argument index is initialized at run time, allowing
+    RISC OS and ARM Tube OS users to re-invoke CRC RevEng from
+    memory using *Go.
+  * Replaced getopt library.
+  * Removed underscores from system calls.
+  * Updated documentation.
+
+-------------------------------------------------------------------
+Sat May 11 10:21:24 UTC 2019 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 2.0.1
+  * Improved robustness of reveng()
+
+-------------------------------------------------------------------

Old:
----
  reveng-2.0.0.tar.xz

New:
----
  reveng-2.0.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ reveng.spec ++++++
--- /var/tmp/diff_new_pack.R01y98/_old  2019-11-06 13:56:54.552208372 +0100
+++ /var/tmp/diff_new_pack.R01y98/_new  2019-11-06 13:56:54.564208384 +0100
@@ -18,13 +18,13 @@
 
 
 Name:           reveng
-Version:        2.0.0
+Version:        2.0.2
 Release:        0
 Summary:        An arbitrary-precision CRC calculator and algorithm finder
 License:        GPL-3.0-or-later
 Group:          Development/Tools/Other
 URL:            http://reveng.sourceforge.net/
-Source:         
http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
+Source:         
https://sourceforge.net/projects/%{name}/files/%{version}/%{name}-%{version}.tar.xz
 Patch0:         reveng-dont-strip.patch
 Patch1:         reveng-obey-cflags.patch
 Patch2:         reveng-presets_x86_64.patch
@@ -48,7 +48,7 @@
 %ifarch x86_64
 %patch2 -p1
 %endif
-%ifarch %ix86
+%ifarch %{ix86}
 %patch3 -p1
 %endif
 
@@ -57,8 +57,8 @@
 export CFLAGS="%{optflags}"
 make %{?_smp_mflags}
 %else
-gcc %{optflags} -Wall -ansi -c bmpbit.c cli.c model.c poly.c preset.c reveng.c
-gcc %{optflags} -o reveng bmpbit.o cli.o model.o poly.o preset.o reveng.o
+cc %{optflags} -Wall -ansi -c bmpbit.c cli.c model.c poly.c preset.c reveng.c
+cc %{optflags} -o reveng bmpbit.o cli.o model.o poly.o preset.o reveng.o
 %endif
 
 %install

++++++ reveng-2.0.0.tar.xz -> reveng-2.0.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/CHANGES new/reveng-2.0.2/CHANGES
--- old/reveng-2.0.0/CHANGES    2019-05-06 17:50:46.000000000 +0200
+++ new/reveng-2.0.2/CHANGES    2019-11-02 16:55:52.000000000 +0100
@@ -19,6 +19,20 @@
 
 Revision history of CRC RevEng
 
+2.0.2  2 November 2019
+       * The memory allocation expands geometrically while reading
+         polynomials from files; this improves performance on large
+         files but memory overhead is increased during the read.
+       * The argument index is initialized at run time, allowing
+         RISC OS and ARM Tube OS users to re-invoke CRC RevEng from
+         memory using *Go.
+       * Replaced getopt library.
+       * Removed underscores from system calls.
+       * Updated documentation.
+
+2.0.1  9 May 2019
+       * Improved robustness of reveng()
+
 2.0.0  6 May 2019
        * Much faster brute force search for generator polynomials if
          the most compact difference between right-aligned arguments is
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/README new/reveng-2.0.2/README
--- old/reveng-2.0.0/README     2019-05-07 18:28:22.000000000 +0200
+++ new/reveng-2.0.2/README     2019-11-02 17:05:30.000000000 +0100
@@ -19,23 +19,12 @@
 
 THIRD-PARTY SOFTWARE
 
-CRC RevEng incorporates source code from ASPEX under the terms of
-version 3 of the GNU General Public License (GPLv3).  ASPEX is:
-
-Copyright (C) 1998, 2003 by David A. Hinds -- All Rights Reserved
-
-Homepage: <http://aspex.sourceforge.net/>
-
-ASPEX is licensed under version 2 and all later versions of the GNU
-General Public License, therefore CRC RevEng remains licensed under
-version 3 and all later versions.
-
-Depending on one's interpretation of the License, the author created a
-modified copy of ASPEX as a whole by extracting files getopt.c and
-getopt.h verbatim on 19 December 2010.  These are found in the contrib/
-directory.  A compatible getopt module is available as standard in many
-environments and will work just as well, but this copy is included for
-those ANSI C environments that lack one.
+CRC RevEng incorporates a public domain implementation of getopt
+written by Keith Bostic and Rich Salz, with extensions added by the
+author.  This is found in the contrib/ directory as file getopt.c.  A
+compatible getopt module is available as standard in many environments
+and will work just as well, but this copy is included for those ANSI C
+environments that lack one.
 
 A copy of the RISC OS Shared C Library (CLib), and a patch to make
 certain versions of RISC OS compatible with this version of CLib, are
@@ -185,7 +174,7 @@
                A hexadecimal digit string specifying the initial value
                to set in the shift register before computing the CRC.
                The width must be specified with -k, -m, -P or -w
-               before -i.
+               before -i INIT.
        -k KPOLY
                The generator polynomial (see -p), written in the
                hexadecimal, reversed-reciprocal notation found in
@@ -220,7 +209,7 @@
                -p also sets the start of the range for polynomial range
                searching, see -q.
                The width must be specified with -k, -m, -P or -w
-               before -p.
+               before -p POLY.
        -P RPOLY
                The generator polynomial (see -p), written in the
                hexadecimal, reversed notation found in LSB-first code.
@@ -241,7 +230,7 @@
                A hexadecimal digit string specifying the value to be
                added to the final shift register value before output.
                The width must be specified with -k, -m, -P or -w
-               before -x.
+               before -x XOROUT.
 
 Other model-related options:
 
@@ -276,13 +265,15 @@
 
 When passing messages as files or as raw binary strings, the same
 division into characters applies; bytes of the message are read until
-enough bits have been collected, then a specified number of bits are
-taken from the specified least significant end of the collection (see
--y), reflected (if RefIn = True) and added to the binary representation.
+enough bits have been collected, then the number of bits specified by -a
+are taken from the specified least significant end of the collection
+(see -y), reflected (if RefIn = True) and added to the binary
+representation.
 
 When printing CRCs, the binary representation is again divided into
-characters, each of which is reversed (if RefOut = True) and printed
-with the minimum sufficient number of hex digits.
+characters (of size specified by the -A option), each of which is
+reversed (if RefOut = True) and printed with the minimum sufficient
+number of hex digits.
 
 Output model records conform to the Williams model set out in "A
 Painless Guide to CRC Error Detection Algorithms".  To recap, the model
@@ -303,25 +294,26 @@
 The refout parameter, if equal to false, specifies that the contents of
 the register after reading the last message bit are unreflected before
 presentation; if equal to true, it specifies that they are reflected,
-character-by-character, before presentation.  For the purpose of this
-definition, the reflection is performed by swapping the content of each
-cell with that of the cell an equal distance from the opposite end of
-the register; the characters of CRCs output by -c and -v are then true
-images of parts of the reflected register, the character containing the
-original MSB always appearing first.  The xorout parameter defines the
-XOR value applied to the contents of the register after the last message
-bit has been read and after the optional reflection.  The check
-parameter defines the contents of the register after initialising,
-reading the UTF-8 string "123456789" (as 8-bit characters), optionally
-reflecting, and applying the final XOR.  The residue parameter defines
-the contents of the register after initialising, reading an error-free
-codeword and optionally reflecting the register (if refout=true), but
-not applying the final XOR.  This is mathematically equivalent to
-initialising the register with the xorout parameter, reflecting it as
-described (if refout=true), reading as many zero bits as there are cells
-in the register, and reflecting the result (if refin=true).  The residue
-of a crossed-endian model is calculated assuming that the characters of
-the received CRC are specially reflected before submitting the codeword.
+character-by-character, before presentation.  For the purpose of the
+definitions below, the reflection is performed before the division into
+characters, by swapping the content of each cell with that of the cell
+an equal distance from the opposite end of the register; the characters
+(size defined by -A) of CRCs output by -c and -v are then true images of
+parts of the reflected register, the character containing the original
+MSB always appearing first.  The xorout parameter defines the XOR value
+applied to the contents of the register after the last message bit has
+been read and after the optional reflection.  The check parameter
+defines the contents of the register after initialising, reading the
+UTF-8 string "123456789" (as 8-bit characters), optionally reflecting,
+and applying the final XOR.  The residue parameter defines the contents
+of the register after initialising, reading an error-free codeword and
+optionally reflecting the register (if refout=true), but not applying
+the final XOR.  This is mathematically equivalent to initialising the
+register with the xorout parameter, reflecting it as described (if
+refout=true), reading as many zero bits as there are cells in the
+register, and reflecting the result (if refin=true).  The residue of a
+crossed-endian model is calculated assuming that the characters of the
+received CRC are specially reflected before submitting the codeword.
 
 width is printed as a decimal integer.  poly, init, xorout, check and
 residue are true images of the shift register at various times, printed
@@ -460,7 +452,7 @@
 
 Now exclusive-OR the two returned CRCs together, and insert the result
 in the unused space.  CRC RevEng can be used to do the exclusive-OR if a
-hex calculator is not to hand:
+hex calculator is not at hand:
 
        reveng -w 16 -p 0001 -c 9dc51505
        88c0
@@ -672,7 +664,8 @@
                each argument, so that when the argument is not a whole
                number of bytes long, an equivalent string can be
                produced for input to a bytewise calculator (which has
-               Init set to 0).
+               Init set to 0).  To prevent this once Init has been set,
+               follow with -k 0.
        -h
        -u
        -?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/RISCOSify new/reveng-2.0.2/RISCOSify
--- old/reveng-2.0.0/RISCOSify  2019-03-04 21:04:15.000000000 +0100
+++ new/reveng-2.0.2/RISCOSify  2019-10-02 21:45:06.000000000 +0200
@@ -1,5 +1,5 @@
 | RISCOSify
-| Greg Cook, 23/Feb/2019
+| Greg Cook, 2/Oct/2019
 
 | CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
 | Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
@@ -31,6 +31,7 @@
 IfThere <CRCRevEng$Dir>.bin.armtubeos.reveng/inf Then SetType 
<CRCRevEng$Dir>.bin.armtubeos.reveng/inf &FFF
 IfThere <CRCRevEng$Dir>.bin.i386-linux.reveng Then SetType 
<CRCRevEng$Dir>.bin.i386-linux.reveng &FE6
 IfThere <CRCRevEng$Dir>.bin.raspbian.reveng Then SetType 
<CRCRevEng$Dir>.bin.raspbian.reveng &FE6
+IfThere <CRCRevEng$Dir>.bin.riscos.ReadMe/txt Then SetType 
<CRCRevEng$Dir>.bin.riscos.ReadMe/txt &FFF
 IfThere <CRCRevEng$Dir>.bin.riscos.reveng Then SetType 
<CRCRevEng$Dir>.bin.riscos.reveng &FF8
 IfThere 
<CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Choices.Default.Boot.PreDesk.!!CCRomPtc
 Then SetType 
<CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Choices.Default.Boot.PreDesk.!!CCRomPtc
 &FEB
 IfThere 
<CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Choices.Default.Boot.PreDesk.CCRomPtc.!Load
 Then SetType 
<CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Choices.Default.Boot.PreDesk.CCRomPtc.!Load
 &FEB
@@ -42,7 +43,6 @@
 IfThere <CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Resources.!System.!Run 
Then SetType <CRCRevEng$Dir>.bin.riscos.Select_429.!Boot.Resources.!System.!Run 
&FEB
 IfThere <CRCRevEng$Dir>.bin.riscos.!System.310.Modules.CLib Then SetType 
<CRCRevEng$Dir>.bin.riscos.!System.310.Modules.CLib &FFA
 IfThere <CRCRevEng$Dir>.bin.riscos.!System.500.Modules.CLib Then SetType 
<CRCRevEng$Dir>.bin.riscos.!System.500.Modules.CLib &FFA
-IfThere <CRCRevEng$Dir>.bin.riscos.!System.ReadMe/txt Then SetType 
<CRCRevEng$Dir>.bin.riscos.ReadMe/txt &FFF
 IfThere <CRCRevEng$Dir>.bin.win32.reveng/exe Then SetType 
<CRCRevEng$Dir>.bin.win32.reveng/exe &FE4
 IfThere <CRCRevEng$Dir>.bmpbit/c Then SetType <CRCRevEng$Dir>.bmpbit/c &FFF
 IfThere <CRCRevEng$Dir>.CHANGES Then SetType <CRCRevEng$Dir>.CHANGES &FFF
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/bin/armtubeos/README 
new/reveng-2.0.2/bin/armtubeos/README
--- old/reveng-2.0.0/bin/armtubeos/README       2019-05-07 17:47:43.000000000 
+0200
+++ new/reveng-2.0.2/bin/armtubeos/README       2019-11-01 19:59:18.000000000 
+0100
@@ -1,26 +1,31 @@
 System requirements of ARM Tube OS binary
-Greg Cook, 7 May 2019
+Greg Cook, 1 November 2019
 
 CRC RevEng has been tested on a 16MB SPROW ARM7TDMI Coprocessor running
 ARM Tube OS version 0.45, with OS 1.20 on the host.  Installation on
 disc is strongly recommended.
 The following filing systems are known to be compatible:-
 
-- OPUS EDOS 0.4, patched by EDOSPAT versions 4.90, 5.31 or 6.01
-- Acorn DFS 2.26, as supplied with the GoMMC interface (PDFS226.BIN)
+- OPUS EDOS 0.4, patched by EDOSPAT versions 4.90, 5.40 or 6.03
+
+Acorn DFS 2.26, as supplied with the GoMMC interface (PDFS226.BIN) is
+verified for invocations that do not read files (command lines without
+-f).
 
 To load and run the ARM Tube OS binary successfully, the Disc Filing
 System (DFS) on the host computer must support at least the following:
-- Full 32-bit address handling within *RUN (image loading and execution).
+- Full 32-bit address handling within *RUN (image loading and execution)
 - Ability to load images >64 KiB to the coprocessor.
-- Tolerance of OSARGS calls with A=2, Y=0.
+- Tolerance of OSARGS calls with A=2, Y=0 (read NFS version).
 - OSFIND must support reason codes with bit 3 set and tolerate reason
   codes with bit 2 set (see RISC OS 3 Programmer's Reference Manual,
   volume 2, page 79)
 
-It is not possible to use *Go to re-execute the binary image after
-loading; CRC RevEng does not receive the command line arguments
-following the *Go address.
+Once CRC RevEng has been loaded and executed, it can be reinvoked
+without reloading the image, using *Go:-
+
+       *reveng -h
+       *Go ; -m crc-16/ibm-sdlc -c 313233343536373839
 
 Estimated brute force search times, including loading time, and progress
 report intervals on the SPROW ARM7TDMI Coprocessor are as follows:-
Binary files old/reveng-2.0.0/bin/armtubeos/reveng and 
new/reveng-2.0.2/bin/armtubeos/reveng differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/bin/armtubeos/reveng.inf 
new/reveng-2.0.2/bin/armtubeos/reveng.inf
--- old/reveng-2.0.0/bin/armtubeos/reveng.inf   2019-05-06 23:04:59.000000000 
+0200
+++ new/reveng-2.0.2/bin/armtubeos/reveng.inf   2019-11-02 16:53:48.000000000 
+0100
@@ -1 +1 @@
-$.reveng 8000 8000 10C6F CRC=F3D2
+$.reveng 8000 8000 10D6F CRC=8FA6
Binary files old/reveng-2.0.0/bin/i386-linux/reveng and 
new/reveng-2.0.2/bin/i386-linux/reveng differ
Binary files old/reveng-2.0.0/bin/raspbian/reveng and 
new/reveng-2.0.2/bin/raspbian/reveng differ
Binary files old/reveng-2.0.0/bin/riscos/reveng and 
new/reveng-2.0.2/bin/riscos/reveng differ
Binary files old/reveng-2.0.0/bin/win32/reveng.exe and 
new/reveng-2.0.2/bin/win32/reveng.exe differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/cli.c new/reveng-2.0.2/cli.c
--- old/reveng-2.0.0/cli.c      2019-04-30 18:24:30.000000000 +0200
+++ new/reveng-2.0.2/cli.c      2019-11-02 15:41:12.000000000 +0100
@@ -1,5 +1,5 @@
 /* cli.c
- * Greg Cook, 29/Apr/2019
+ * Greg Cook, 2/Nov/2019
  */
 
 /* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
@@ -22,7 +22,9 @@
  * along with CRC RevEng.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-/* 2019-03-24: error message also requests -P before -s
+/* 2019-11-01: initialize optind, opterr
+ * 2019-11-01: grow poly geometrically in rdpoly()
+ * 2019-03-24: error message also requests -P before -s
  * 2018-07-26: NOFORCE renamed ALWPCK
  * 2017-02-18: -G ignored if R_HAVEP
  * 2017-02-05: added -G
@@ -87,13 +89,18 @@
        int c, mode = 0, args, psets, pass;
        poly_t apoly, crc, qpoly = PZERO, *apolys, *pptr = NULL, *qptr = NULL;
        model_t pset = model, *candmods, *mptr;
-       char *string;
+       char *string = "", **nargv = &string;
 
        myname = argv[0];
 
+       /* reset getopt() with our extension in case user used *Go */
+       optind = 0; opterr = 0;
+       c=getopt(1, nargv, string);
+       optind = 1; opterr = 1;
+
        /* stdin must be binary */
 #ifdef _WIN32
-       _setmode(STDIN_FILENO, _O_BINARY);
+       setmode(STDIN_FILENO, O_BINARY);
 #endif /* _WIN32 */
 
        SETBMP();
@@ -511,14 +518,35 @@
        /* read poly from file in chunks and report errors */
 
        poly_t apoly = PZERO, chunk = PZERO;
+       unsigned long total = 0UL, a, b;
        FILE *input;
 
        input = oread(name);
        while(!feof(input) && !ferror(input)) {
                chunk = filtop(input, BUFFER, flags, bperhx);
-               psum(&apoly, chunk, plen(apoly));
+               total += plen(chunk);
+               if((a = b = total) > plen(apoly)) {
+                       /* Grow apoly geometrically */
+                       /* Find a = power of two not greater than total */
+                       /* total > 0 */
+                       while(b) {
+                               a = b;
+                               b &= (b - 1UL);
+                       }
+                       /* 0 < a <= total */
+                       /* Add quanta to a until it equals or exceeds total */
+                       if(!(b = a >> GSCALE))
+                               b = 1UL;
+                       while(a < total)
+                               a += b;
+                       /* Allocate a bits to apoly */
+                       praloc(&apoly, a);
+               }
+               psum(&apoly, chunk, total - plen(chunk));
                pfree(&chunk);
        }
+       praloc(&apoly, total);
+
        if(ferror(input)) {
                fprintf(stderr,"%s: error condition on file '%s'\n", myname, 
name);
                exit(EXIT_FAILURE);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/contrib/getopt.c 
new/reveng-2.0.2/contrib/getopt.c
--- old/reveng-2.0.0/contrib/getopt.c   2010-12-19 15:46:08.000000000 +0100
+++ new/reveng-2.0.2/contrib/getopt.c   2019-11-02 15:31:08.000000000 +0100
@@ -1,81 +1,116 @@
-/*----------------------------------------------------------------------
+/* transcript/src/getopt.c
+ *
+ * public domain getopt from mod.sources
+ * RCSID: $Header: getopt.c,v 2.1 85/11/24 11:49:10 shore Rel $
+ */
+
+/*
+**  This is a public domain version of getopt(3).
+**  Bugs, fixes to:
+**             Keith Bostic
+**                     ARPA: keith@seismo
+**                     UUCP: seismo!keith
+**  Added NO_STDIO, opterr handling, Rich $alz (mirror!rs).
+**  Converted to ANSI C, optind=0 extension
+**  Greg Cook <debou...@yahoo.co.uk>
+*/
 
-    Replacement for Unix "getopt()", for DOS/Windows/etc.
-
-    getopt.c 1.3 2003/09/17 16:17:59
+#include <stdio.h>
+#include <string.h>
+#include "getopt.h"
 
-    Copyright (C) 1998, 2003 by David A. Hinds -- All Rights Reserved
+/*
+**  Error macro.  Maybe we want stdio, maybe we don't.
+**  The (undocumented?) variable opterr tells us whether or not
+**  to print errors.
+*/
+
+#ifdef NO_STDIO
+
+#define tell(s)                                                                
\
+       if (opterr)                                                     \
+       {                                                               \
+           char        ebuf[2];                                        \
+           (void)write(2, nargv, (unsigned int)strlen(nargv));         \
+           (void)write(2, s, (unsigned int)strlen(s));                 \
+           ebuf[0] = optopt;                                           \
+           ebuf[1] = '\n';                                             \
+           (void)write(2, ebuf, 2);                                    \
+       }
 
-    This file is part of ASPEX.
+#else
 
-    ASPEX is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+#define tell(s)                                                                
\
+       if (opterr)                                                     \
+           (void)fputs(*nargv, stderr),                                \
+           (void)fputs(s,stderr),                                      \
+           (void)fputc(optopt, stderr),                                \
+           (void)fputc('\n', stderr)
 
-    ASPEX is distributed in the hope that it will be useful, but
-    WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    General Public License for more details.
+#endif
 
-    You should have received a copy of the GNU General Public License
-    along with ASPEX; if not, write to the Free Software Foundation,
-    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-----------------------------------------------------------------------*/
+/* Global variables. */
+static char     EMSG[] = "";
+int             opterr = 1;            /* undocumented error-suppressor*/
+int             optind = 1;            /* index into argv vector       */
+int             optopt;                /* char checked for validity    */
+char           *optarg;                /* arg associated with option   */
 
-#include "string.h"
-#include "stdio.h"
-#include "getopt.h"
 
-char *optarg;
-int optind = 1, opterr, optopt;
 
-int getopt(int argc, char *argv[], const char *optstring)
+int getopt(int nargc, char **nargv, char *ostr)
 {
-    static int pos = 0;
-    char *str;
-    
-    if (pos == 0) {
-       if ((optind >= argc) || (*argv[optind] != '-'))
-           return EOF;
-       pos = 1;
-       if (argv[optind][pos] == '\0')
-           return EOF;
-    }
-    
-    str = strchr(optstring, argv[optind][pos]);
-    if (str == NULL) {
-       optopt = argv[optind][pos];
-       if (opterr)
-           fprintf(stderr, "%s: illegal option -- %c\n", argv[0],
-                   optopt);
-       return '?';
+    static char                 *place = EMSG; /* option letter processing     
*/
+    register char       *oli;          /* option letter list index     */
+
+    if (!optind) {                     /* extension: reset getopt -GJC */
+       place = EMSG;
+       ++optind;
+       return(EOF);
     }
-    
-    if (str[1] == ':') {
-       if (argv[optind][pos+1] != '\0') {
-           optarg = &argv[optind][pos+1];
-           return *str;
-       }
-       optind++;
-       if (optind >= argc) {
-           optopt = *str;
-           if (opterr)
-               fprintf(stderr, "%s: option requires an argument -- %c\n",
-                       argv[0], optopt);
-           return '?';
+
+    if (!*place)                       /* update scanning pointer      */
+    {
+       if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place)
+           return(EOF);
+       if (*place == '-')              /* found "--"                   */
+       {
+           optind++;
+           return(EOF);
        }
-       optarg = argv[optind];
-       optind++; pos = 0;
-       return *str;
     }
-    else {
-       pos++;
-       if (argv[optind][pos] == '\0') {
+    /* option letter okay? */
+    if ((optopt = *place++) == ':' || (oli = strchr(ostr, optopt)) == NULL)
+    {
+       if (!*place)
            optind++;
-           pos = 0;
-       }
-       return *str;
+       tell(": illegal option -- ");
+       goto Bad;
+    }
+    if (*++oli != ':')                 /* don't need argument          */
+    {
+       optarg = NULL;
+       if (!*place)
+           optind++;
+    }
+    else                               /* need an argument             */
+    {
+       if (*place)
+           optarg = place;             /* no white space               */
+       else
+           if (nargc <= ++optind)
+           {
+               place = EMSG;
+               tell(": option requires an argument -- ");
+               goto Bad;
+           }
+           else
+               optarg = nargv[optind]; /* white space                  */
+       place = EMSG;
+       optind++;
     }
+    return(optopt);                    /* dump back option letter      */
+Bad:
+    return('?');
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/contrib/getopt.h 
new/reveng-2.0.2/contrib/getopt.h
--- old/reveng-2.0.0/contrib/getopt.h   2010-12-19 15:45:16.000000000 +0100
+++ new/reveng-2.0.2/contrib/getopt.h   2014-02-01 14:50:11.000000000 +0100
@@ -1,25 +1,11 @@
-/*
-    getopt.h 1.2 2003/09/17 16:17:59
-
-    Copyright (C) 1998, 2003 by David A. Hinds -- All Rights Reserved
-
-    This file is part of ASPEX.
-
-    ASPEX is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    ASPEX is distributed in the hope that it will be useful, but
-    WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with ASPEX; if not, write to the Free Software Foundation,
-    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-extern char *optarg;
-extern int optind, opterr, optopt;
-int getopt(int argc, char *argv[], const char *optstring);
+/* Public domain getopt.h, Greg Cook, <debou...@yahoo.co.uk> */
+
+#ifndef   GETOPT_H
+#  define GETOPT_H
+extern int      opterr;                /* undocumented error-suppressor*/
+extern int      optind;                /* index into argv vector       */
+extern int      optopt;                /* char checked for validity    */
+extern char    *optarg;                /* arg associated with option   */
+
+extern int      getopt(int nargc, char **nargv, char *ostr);
+#endif /* GETOPT_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/poly.c new/reveng-2.0.2/poly.c
--- old/reveng-2.0.0/poly.c     2019-05-03 21:36:56.000000000 +0200
+++ new/reveng-2.0.2/poly.c     2019-05-09 23:20:35.000000000 +0200
@@ -1,5 +1,5 @@
 /* poly.c
- * Greg Cook, 3/May/2019
+ * Greg Cook, 9/May/2019
  */
 
 /* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
@@ -934,7 +934,7 @@
                palloc(quotient, max);
        bptr=message.bitmap;
        eptr=message.bitmap+SIZE(message.length);
-       qptr=quotient ? quotient->bitmap : 0;
+       qptr=quotient ? quotient->bitmap : NULL;
        probe=~(~BMP_C(0) >> 1);
        if(divisor.length <= (unsigned long) BMP_BIT
                && init.length <= (unsigned long) BMP_BIT) {
@@ -1022,7 +1022,7 @@
                ++rptr;
                while(bptr < eptr)
                        *rptr++ ^= *bptr++;
-               
+
                /* 0 <= ofs <= BMP_BIT, location of the first bit of the result 
*/
                pshift(&result, result, 0UL, ofs, (init.length > max + 
divisor.length ? init.length - max - divisor.length : 0UL) + divisor.length + 
ofs, 0UL);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/reveng.c new/reveng-2.0.2/reveng.c
--- old/reveng-2.0.0/reveng.c   2019-05-06 22:42:06.000000000 +0200
+++ new/reveng-2.0.2/reveng.c   2019-05-09 23:20:38.000000000 +0200
@@ -1,5 +1,5 @@
 /* reveng.c
- * Greg Cook, 3/May/2019
+ * Greg Cook, 9/May/2019
  */
 
 /* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
@@ -66,53 +66,86 @@
 model_t *
 reveng(const model_t *guess, const poly_t qpoly, int rflags, int args, const 
poly_t *argpolys) {
        /* Complete the parameters of a model by calculation or brute search. */
-       poly_t *pworks, *wptr, rem, factor, gpoly = PZERO, qqpoly = PZERO, 
*gptr = 0;
+       poly_t *pworks, *wptr, rem = PZERO, factor = PZERO, gpoly = PZERO, 
qqpoly = PZERO;
        model_t *result = NULL, *rptr;
        int resc = 0;
        unsigned long spin = 0, seq = 0;
 
-       if(~rflags & R_HAVEP) {
+       if(rflags & R_HAVEP) {
+               /* The poly is known.  Engineer, calculate or return
+                * Init and XorOut.
+                */
+               dispch(guess, &resc, &result, guess->spoly, rflags, args, 
argpolys);
+       } else {
                /* The poly is not known.
                 * Produce a list of differences between the arguments.
                 */
+               if(!plen(guess->spoly))
+                       goto requit;
                pworks = modpol(guess->init, rflags, args, argpolys);
-               /* If no differences are returned, there is nothing to do. */
-               if(!pworks || !plen(*pworks)) {
-                       free(pworks);
+               /* If too short a difference is returned, there is nothing to 
do. */
+               if(!pworks)
                        goto requit;
-               }
-               /* If the shortest difference is the right length for the
-                * generator polynomial (with its top bit), then it *is*
-                * the generator polynomial.
+               else if(plen(*pworks) < plen(guess->spoly) + 1UL)
+                       goto rpquit;
+
+               /* plen(*pworks) >= 2 */
+               /* If the shortest difference is the right length for the 
generator
+                * polynomial (with its top bit), then it *is* the generator 
polynomial.
                 */
                else if(plen(*pworks) == plen(guess->spoly) + 1UL) {
                        pcpy(&gpoly, *pworks);
-                       pshift(&gpoly,gpoly,0UL,1UL,plen(gpoly),0UL);
+                       /* Chop the generator. + 1 term is present
+                        * as differences come normalized from modpol().
+                        */
+                       pshift(&gpoly,gpoly,0UL,1UL,plen(gpoly),0UL); /* 
plen(gpoly) >= 1 */
                        dispch(guess, &resc, &result, gpoly, rflags, args, 
argpolys);
-                       pfree(&gpoly);
-                       goto requit;
+                       goto rpquit;
                }
                /* Otherwise initialise the trial factor to the starting value. 
*/
                factor = pclone(guess->spoly);
                if(rflags & R_HAVEQ)
                        qqpoly = pclone(qpoly);
 
-               /* Truncate trial factor if shortest difference is compact. */
-               if(plen(*pworks) <= (plen(guess->spoly)) << 1) {
-                       pright(&factor, plen(*pworks) - plen(guess->spoly) - 
1UL);
-                       if(rflags & R_HAVEQ)
-                               pright(&qqpoly, plen(*pworks) - 
plen(guess->spoly) - 1UL);
-                       /* Point gptr to gpoly so that pcrc() returns the 
quotient. */
-                       gptr = &gpoly;
+               /* Truncate trial factor and range end polynomial
+                * if shortest difference is compact.
+                */
+               rflags &= ~R_SHORT;
+               if(plen(*pworks) <= (plen(factor)) << 1) { /* plen(*pworks) >= 
4, plen(factor) >= 2 */
+                       rflags |= R_SHORT;
+                       if((rflags & R_HAVEQ) || ptst(factor)) {
+                               /* Validate range polynomials.
+                                * Ensure proper behaviour if the search space 
is
+                                * naively divided up as per the README.
+                                */
+                               palloc(&rem, plen(*pworks) - plen(factor) - 
1UL); /* >= 1 */
+                               pinv(&rem);
+                               pright(&rem, plen(factor)); /* >= 1 */
+
+                               /*  If start polynomial out of range, do not 
search. */
+                               if(pcmp(&rem, &factor) < 0)
+                                       goto rpquit;
+                               /* If end polynomial out of range, do not 
compare,
+                                * just quit when trial factor rolls over.
+                                */
+                               else if(pcmp(&rem, &qqpoly) < 0)
+                                       rflags &= ~R_HAVEQ;
+                               /* Otherwise truncate end polynomial. */
+                               else if(rflags & R_HAVEQ)
+                                       pright(&qqpoly, plen(*pworks) - 
plen(factor) - 1UL); /* >= 1 */
+                               pfree(&rem);
+                       }
+                       /* Truncate trial factor. */
+                       pright(&factor, plen(*pworks) - plen(factor) - 1UL); /* 
>= 1 */
                }
 
                /* Clear the least significant term, to be set in the
                 * loop. qpoly does not need fixing as it is only
                 * compared with odd polys.
                 */
-               if(plen(factor))
-                       pshift(&factor, factor, 0UL, 0UL, plen(factor) - 1UL, 
1UL);
+               pshift(&factor, factor, 0UL, 0UL, plen(factor) - 1UL, 1UL);
 
+               /* plen(factor) >= 1 */
                while(piter(&factor) && (~rflags & R_HAVEQ || pcmp(&factor, 
&qqpoly) < 0)) {
                        /* For each possible poly of this size, try
                         * dividing all the differences in the list.
@@ -120,27 +153,30 @@
                        if(!(spin++ & R_SPMASK)) {
                                uprog(factor, guess->flags, seq++);
                        }
-                       if(gptr) {
-                               /* divide first difference by cofactor to get 
generator */
+                       if(rflags & R_SHORT) {
+                               /* test whether cofactor divides shortest 
difference */
                                wptr = pworks;
-                               if(plen(*wptr)) {
-                                       rem = pcrc(*wptr, factor, pzero, pzero, 
0, 0);
-                                       if(ptst(rem)) {
-                                               pfree(&rem);
-                                       } else {
-                                               pfree(&rem);
-                                               /* test generator against other 
differences */
-                                               rem = pcrc(*pworks, factor, 
pzero, pzero, 0, &gpoly);
-                                               pfree(&rem);
-                                               
pshift(&gpoly,gpoly,0UL,1UL,plen(gpoly),0UL);
-                                               for(++wptr; plen(*wptr); 
++wptr) {
-                                                       rem = pcrc(*wptr, 
gpoly, pzero, pzero, 0, 0);
-                                                       if(ptst(rem)) {
-                                                               pfree(&rem);
-                                                               break;
-                                                       } else
-                                                               pfree(&rem);
-                                               }
+                               rem = pcrc(*wptr, factor, pzero, pzero, 0, 
NULL);
+                               if(ptst(rem)) {
+                                       pfree(&rem);
+                               } else {
+                                       pfree(&rem);
+                                       /* repeat division to get generator 
polynomial
+                                        * then test generator against other 
differences
+                                        */
+                                       rem = pcrc(*wptr, factor, pzero, pzero, 
0, &gpoly);
+                                       pfree(&rem);
+                                       /* chop generator and ensure + 1 term */
+                                       pshift(&gpoly,gpoly,0UL,1UL,plen(gpoly) 
- 1UL,1UL);
+                                       piter(&gpoly); /* plen(gpoly) >= 1 */
+
+                                       for(++wptr; plen(*wptr); ++wptr) {
+                                               rem = pcrc(*wptr, gpoly, pzero, 
pzero, 0, NULL);
+                                               if(ptst(rem)) {
+                                                       pfree(&rem);
+                                                       break;
+                                               } else
+                                                       pfree(&rem);
                                        }
                                }
                        } else {
@@ -160,13 +196,15 @@
                         */
                        if(!plen(*wptr)) {
                                /* gpoly || factor is a candidate poly */
-                               dispch(guess, &resc, &result, gptr ? gpoly : 
factor, rflags, args, argpolys);
+                               dispch(guess, &resc, &result, (rflags & 
R_SHORT) ? gpoly : factor, rflags, args, argpolys);
                        }
                        if(!piter(&factor))
                                break;
                }
                /* Finished with factor and the differences list, free them.
                 */
+rpquit:
+               pfree(&rem);
                pfree(&qqpoly);
                pfree(&gpoly);
                pfree(&factor);
@@ -174,8 +212,6 @@
                        pfree(wptr);
                free(pworks);
        }
-       else
-               dispch(guess, &resc, &result, guess->spoly, rflags, args, 
argpolys);
 
 requit:
        if(!(result = realloc(result, ++resc * sizeof(model_t))))
@@ -192,6 +228,8 @@
        return(result);
 }
 
+/* Private functions */
+
 static poly_t *
 modpol(const poly_t init, int rflags, int args, const poly_t *argpolys) {
        /* Produce, in ascending length order, a list of differences
@@ -269,7 +307,6 @@
                engini(resc, result, divisor, guess->flags, args, argpolys);
 }
 
-
 static void
 engini(int *resc, model_t **result, const poly_t divisor, int flags, int args, 
const poly_t *argpolys) {
        /* Search for init values implied by the arguments.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/reveng.h new/reveng-2.0.2/reveng.h
--- old/reveng-2.0.0/reveng.h   2019-04-30 18:23:28.000000000 +0200
+++ new/reveng-2.0.2/reveng.h   2019-11-01 13:05:30.000000000 +0100
@@ -1,5 +1,5 @@
 /* reveng.h
- * Greg Cook, 29/Apr/2019
+ * Greg Cook, 1/Nov/2019
  */
 
 /* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
@@ -93,7 +93,7 @@
 /* Global definitions */
 
 /* CRC RevEng version string */
-#define VERSION "2.0.0"
+#define VERSION "2.0.2"
 
 /* bmpbit.c */
 typedef BMP_T bmp_t;
@@ -215,6 +215,7 @@
 #define R_HAVERO     8
 #define R_HAVEX     16
 #define R_HAVEQ     32
+#define R_SHORT     64
 
 #define R_SPMASK 0x7FFFFFFUL
 
@@ -227,6 +228,7 @@
 #define C_RESULT  8
 
 #define BUFFER 32768
+#define GSCALE     4
 
 extern int main(int argc, char *argv[]);
 extern void ufound(const model_t *model);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/reveng-2.0.0/reveng.rc new/reveng-2.0.2/reveng.rc
--- old/reveng-2.0.0/reveng.rc  2019-05-01 00:31:48.000000000 +0200
+++ new/reveng-2.0.2/reveng.rc  2019-05-15 14:51:31.000000000 +0200
@@ -1,5 +1,5 @@
 /* reveng.rc
- * Greg Cook, 30/Apr/2019
+ * Greg Cook, 15/May/2019
  */
 
 /* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
@@ -30,11 +30,11 @@
 
 #include <windows.h>
 
-#define VER_FILEVERSION                        2,0,0,0
-#define VER_FILEVERSION_STR            "2.0.0.0\0"
+#define VER_FILEVERSION                        2,0,2,0
+#define VER_FILEVERSION_STR            "2.0.2.0\0"
 
-#define VER_PRODUCTVERSION             2,0,0,0
-#define VER_PRODUCTVERSION_STR         "2.0.0\0"
+#define VER_PRODUCTVERSION             2,0,2,0
+#define VER_PRODUCTVERSION_STR         "2.0.2\0"
 
 #ifndef DEBUG
 #define VER_DEBUG                      0


Reply via email to