[EMAIL PROTECTED] wrote:
> Im trying to compile a program and IM getting a errormessage, I have
> included the error message bellow.
>
> viking# cc emsg1.c
> emsg1.c: In function `main':
> emsg1.c:197: warning: passing arg 2 of `connect' from incompatible pointer
> type
> /var/tmp/ccRu22801.o: In function `main':
> /var/tmp/ccRu22801.o(.text+0x5bb): undefined reference to `cuserid'
> viking#
>
> The software IM trying to compile is a network monitoring tool named
> "EMU", I've found it at "http://www.jarrix.com.au".
>
> At line 197 it looks like this...
>
> if( connect(s, &sin, sizeof(sin)) < 0) {
Cast the second argument to (struct sockaddr *). i.e.
if (connect(s, (struct sockaddr *)&sin, sizeof sin) < 0) {
...
> And where it complains about the "cuserid" bit it looks like this...
>
> /* get my user name */
> if (u_flag == 0) {
> cuserid(myuser);
> }
RTFM. "man cuserid" says:
DESCRIPTION
The cuserid function is made obsolete by getpwuid.
It is available from the compatibility library, libcompat.
So you need to add -lcompat to the command line, or take the manual
page's advice and use getpwuid (with an argument of geteuid()) instead,
and copy the pw_name member of the returned structure to myuser.
--
Ben Smithurst | PGP: 0x99392F7D
[EMAIL PROTECTED] | key available from keyservers and
| [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message