On Sun, Sep 11, 2016 at 11:49:40PM -0700, randy hartman wrote:
> >Synopsis: boggle(6) boardspec is broken
> >Category: user
> >Environment:
> System : OpenBSD 6.0
> Details : OpenBSD 6.0-current (GENERIC.MP) #0: Wed Sep 7 18:51:12
> PDT 2016
>
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine : amd64
> >Description:
> variable ncubes is used before initialization
> causes program to always exit when a boardspec is given
> >How-To-Repeat:
> Using the example command from line 34 of the boggle helpfile:
>
> $ boggle nolezeebnqieegei
> usage: boggle [-Bbcd] [-t time] [-w length] [+[+]] [boardspec]
> >Fix:
> move initialization of ncubes from init() to just before it's used in main()
> broken since init() was added in revision 1.17
committed, thanks,
-Otto
>
> Index: src/games/boggle/boggle/bog.c
> ===================================================================
> RCS file: /cvs/src/games/boggle/boggle/bog.c,v
> retrieving revision 1.31
> diff -u -p -u -r1.31 bog.c
> --- src/games/boggle/boggle/bog.c 27 Aug 2016 02:00:10 -0000 1.31
> +++ src/games/boggle/boggle/bog.c 12 Sep 2016 05:40:51 -0000
> @@ -140,6 +140,8 @@ main(int argc, char *argv[])
> argv += 1;
> }
>
> + ncubes = grid * grid;
> +
> if (argc > 0) {
> if (islower((unsigned char)argv[0][0])) {
> if (strlen(argv[0]) != ncubes) {
> @@ -674,7 +676,6 @@ init(void)
> {
> int i;
>
> - ncubes = grid * grid;
> if (minlength == -1)
> minlength = grid - 1;
> init_adjacencies();