Mail Archives: cygwin/1997/01/29/20:25:57
p.a.c.tavares[SMTP:cabr85 AT ccsun DOT strath DOT ac DOT uk] wrote:
>I found two problems when using functions from string.h (the C one, not
>String.h) in win95. I believe they are caused by bugs in the utilities and
>not by my own mistakes.
>
>1. when using GNU make to create the code the compiler confuses string.h
>and String.h. Because by default String.h comes first on the include path,
>cpp will include the GNU-C++ String.h when it should include C string.h
This is a known problem (as far as I know :-/ ) which seems like it will a
little tricky for the Cygnus people to resolve. Since the OS supplied file
I/O functions are not case sensitive they would have to, I suppose, check
that the case of the program supplied file name matched the case of the
file opened by the OS and fail if they didn't match. This still wouldn't
fix really bad ones like having makefile and Makefile in the same directory.
>2. Once this problem was solved by renaming String.h I found that it
>compiled and linked with no problems. However I get a runtime error
>concerning the function strncpy( ). Under gdb I get the following report:
>
>Program received signal SIGSEGV, Segmentation fault.
>strncpy (dst=0x263eb30 "H_c\002\027&@", src=0x0, n=20)
> at /pizza/mushroom/noer/beta17/src/newlib/libc/string/strncpy.c:58
>/pizza/mushroom/noer/beta17/src/newlib/libc/string/strncpy.c:58: No such file or
> directory.
>Current language: auto; currently c
The debugger appears to be telling you that you called strncpy with a null
src pointer (src=0x0), which would indeed cause a segmentation fault. If
your code is not at fault then something truly bizarre is happening to make
the src pointer zero before it gets to the strncpy function. I have to
admit I suspect the calling code (i.e. your code), not the library... sorry.
Good luck,
Colin.
-- Colin Peters - colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp
-- Saga University Dept. of Information Science
-- Fundamentals of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/home.html
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -