libc.so gets() warning on FreeBSD

GRASS 4.2 uses gets() function, which is unsafe, many times and
libc.so warns this every gets() call. There are so many garbage output.

You should rebuild standard c library.

Get library sources from FreeBSD archives,

then

        cd /usr/src/lib/libc

        vi stdio/gets.c
                COMMENT OUT THE FOLLOWING LINES:

                        if (!warned) {
                                (void) write(STDERR_FILENO, w, sizeof(w) - 1);
                                warned = 1;
                        }

                LIKE THIS:

                /*
                        if (!warned) {
                                (void) write(STDERR_FILENO, w, sizeof(w) - 1);
                                warned = 1;
                        }
                */

                SAVE FILE AND QUIT VI

        make

        vi stdio/gets.c
                UNCOMMENT THE ABOVE LINES LIKE THIS:

                        if (!warned) {
                                (void) write(STDERR_FILENO, w, sizeof(w) - 1);
                                warned = 1;
                        }

                SAVE FILE AND QUIT VI

        mkdir /usr/local/grass42/lib

        cd /usr/local/grass42/lib

        cp /usr/obj/usr/src/lib/libc/libc.so.3 .

    IF /usr/obj/.../libc.so.3 DOES NOT EXIST,
            cp /usr/src/lib/libc/libc.so.3 .

        ln -s libc.so.3 libc.so

Now prepend the following line to /usr/local/grass42/bin/grass4.2:

        export LD_LIBRARY_PATH=/usr/local/grass42/lib:$LD_LIBRARY_PATH

Here is my grass4.2:
----<cut here>----
:
export LD_LIBRARY_PATH=/usr/local/grass42/lib:$LD_LIBRARY_PATH
GISBASE=/usr/local/grass42
export GISBASE
exec $GISBASE/etc/GIS.sh
----<cut here>----

If you need FreeBSD 3.3 libc library, this is available from:

        ftp://geni.knu.ac.kr/pub/geni/patch/grass42/libc.so.3

Do not forget 'ln -s libc.so.3 libc.so' and LD_LIBRARY_PATH.

Regards,
Huidae Cho

On Fri, May 26, 2000 at 04:14:32AM +0900, User for GRASS wrote:

GRASS 4.2 uses gets() function, which is unsafe, many times and
libc.so warns this every gets() call. There are so many garbage output.
You should rebuild standard c library.

Isn't there a library that GRASS uses that you could define a replacement
gets() in that uses fgets() instead? Changing libc seems brutal.

--
James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/

On Fri, May 26, 2000 at 09:24:16AM +1000, James Cameron wrote:

On Fri, May 26, 2000 at 04:14:32AM +0900, User for GRASS wrote:
> GRASS 4.2 uses gets() function, which is unsafe, many times and
> libc.so warns this every gets() call. There are so many garbage output.
> You should rebuild standard c library.

Isn't there a library that GRASS uses that you could define a replacement
gets() in that uses fgets() instead? Changing libc seems brutal.

Hi all,

using GRASS 4.x with gets obviously does not cause problems
(beside the compile warnings).

Side note: GRASS 5 does not use gets() but fgets(). It was heavily
upgraded the last month by many contributors.

Best wishes

Markus