The coreutils-4.5.9 build with native c89 on SGI IRIX 6.5 failed
like this:

        c89 -DLIBDIR=\"/usr/local/lib\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.  
-I/usr/local/include  -g -c `test -f 'getcwd.c' || echo './'`getcwd.c
        cc-1140 c89: ERROR File = getcwd.c, Line = 59
          A value of type "int" cannot be used to initialize an entity of type "char 
*".

            char *cwd = getcwd (buf, size);
                        ^

        1 error detected in the compilation of "getcwd.c".

The reason is that the prototype for getcwd is not visible in the c89
environment.

I added a suitable prototype:

        diff lib/getcwd.c.~1~ lib/getcwd.c
        38a39,40
        > extern char *(getcwd)(char *, size_t);
        >

restarted the make, and all of the validation tests then passed.

My patch is a temporary hack.  configure already does some getcwd
tests:

        checking whether getcwd (NULL, 0) allocates memory for result... no
        checking for getcwd... yes
        checking whether getcwd properly handles paths longer than PATH_MAX... yes

It just needs to make one more check for declaration of that function,
and if it isn't found, supply one similar to mine above [the
parentheses around getcwd are needed because the code has

        #undef getcwd

just before that].

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 581 4148                  -
- University of Utah                    Internet e-mail: [EMAIL PROTECTED]  -
- Department of Mathematics, 110 LCB        [EMAIL PROTECTED]  [EMAIL PROTECTED] -
- 155 S 1400 E RM 233                       [EMAIL PROTECTED]                    -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to