Bug 16825

Summary: "team.c" won't compile
Product: Ports & Packages Reporter: John_David_Galt <John_David_Galt>
Component: Individual Port(s)Assignee: Joerg Wunsch <joerg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description John_David_Galt 2000-02-19 21:00:02 UTC
"team.c", in /cdrom/distfiles/team-3.1.tar.gz of CD #4, won't compile.
cc complains that the type "sys_errlist" is already defined.

Fix: 

Patch team.c as follows (diff):

289d288
< #if 0         /* defined in stdio.h on FreeBSD */
291,292c290
< #endif
<     const char                *errmsg = sys_errlist[errno];
---
>     char              *errmsg = sys_errlist[errno];
346c344
<   case FdEOF:     return 0;
---
>   when FdEOF:     return 0;
387c385
<   case FdEOF:     return 0;
---
>   when FdEOF:     return 0;
569c567
<   case TokenREAD:
---
>   when TokenREAD:
976c974
<     case 'i':
---
>     when 'i':

For the first line I would have preferred something like
   #ifndef FREEBSD
but if there's any such thing it isn't documented.
Comment 1 cpiazza freebsd_committer freebsd_triage 2000-02-20 02:44:06 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-ports

Misfiled PR 
Comment 2 Michael Haro freebsd_committer freebsd_triage 2000-04-02 03:41:35 UTC
Responsible Changed
From-To: freebsd-ports->joerg

Over to maintainer 
Comment 3 Joerg Wunsch 2000-04-02 08:57:05 UTC
As John_David_Galt@acm.org wrote:

> "team.c", in /cdrom/distfiles/team-3.1.tar.gz of CD #4, won't compile.
> cc complains that the type "sys_errlist" is already defined.

I'm afraid i can't follow you.  You are actually trying to compile the
port, or are you just picking the distfile, and rolling your own?  The
port takes care of setting the required -D switches to the compiler:

uriah # make
===>  Extracting for team-3.1
>> Checksum OK for team-3.1.tar.gz.
===>  Patching for team-3.1
===>  Applying FreeBSD patches for team-3.1
===>  Configuring for team-3.1
===>  Building for team-3.1
Warning: Object directory not changed from original /usr/ports/misc/team/work/team-3.1
cc -O2 -pipe -DHAVE_PARAM_H -DHAVE_WAIT_H   -c team.c
team.c: In function `FdRead':
team.c:362: warning: unreachable code at beginning of switch statement
team.c: In function `FdWrite':
team.c:403: warning: unreachable code at beginning of switch statement
team.c: In function `GuyStart':
team.c:585: warning: unreachable code at beginning of switch statement
team.c: In function `main':
team.c:1003: warning: unreachable code at beginning of switch statement
cc -O2 -pipe -DHAVE_PARAM_H -DHAVE_WAIT_H    -o team team.o  
gzip -cn team.1 > team.1.gz

The -D_HAVE_PARAM_H causes the symbold BSD to be defined, and the code
in question is already properly ifdef'ed:

#  if !(defined(BSD) && (BSD >= 199306))
    extern char         *(sys_errlist[]); 
#  endif

Also:

> 289d288
> < #if 0         /* defined in stdio.h on FreeBSD */
> 291,292c290
> < #endif
> <     const char                *errmsg = sys_errlist[errno];
> ---
> >     char              *errmsg = sys_errlist[errno];

please always submit context diffs, in particular:

> 346c344
> <   case FdEOF:     return 0;
> ---
> >   when FdEOF:     return 0;

...since you're obviously tweaking a lot more than your description
admits.  (Yes, i know, the pseudo-Pascal in team's code looks a little
weird at first, but then, this was the decision of the author to write
it that way and is thus beyond the scope of what a patch should
change.)

-- 
cheers, J"org  /  73 de DL8DTL

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Comment 4 Joerg Wunsch freebsd_committer freebsd_triage 2000-04-02 08:57:47 UTC
State Changed
From-To: open->closed

See the other followup.  Pilot error, the submitter tried to compile the 
distfile without using the (required) diffs from the port.  The port itself 
compiles fine.