On Wed, Oct 01, 2003 at 07:06:00PM +0200, Paul Bijnens wrote:
> Jon LaBadie wrote:
>
> >On Wed, Oct 01, 2003 at 06:28:07PM +0200, Paul Bijnens wrote:
> >>Do "man 3 getopt" to get the page for the C library routines.
> >>
> ...
> >>What I do not know exactly is why gcc doesn't complain on other
> >>OSes about the missing declaration. (in amanda.h I find the
> >>definition for getopt and optarg, but not for optind; actually
> >>you better add the definition there.)
> >>
>
> >
> >Again, this is for Solaris, not SunOS;
> >
> >Sun's man needs the -s option to see other sections and getopt is in 3c.
> >So the command would be "man -s 3c getopt".
>
> $ uname -rs
> SunOS 4.1.4
> $ man -s 3c getopt
> Usage: man [-] [-t] [-M path] [-T tmac.an] [ section ] name ...
> man -k keyword ...
> man -f file ...
>
> SunOS 4.1.x only recognizes "man 3 getopt"
>
> >
> >It indicates that optind and the others are defined in <unistd.h>.
> >So possibly that should be included in your source somewhere (amanda.h?).
>
> Yes, that indeed why on modern OSes gcc does not complain anymore.
> I have only SunOS 4.1.4 in my Jurassic (S)Parc , and there is no
> definition related to getopt in stdlib.h from SunOS 4.1.4
>
> Both ammt.c and amdd.c have explicitly defined optind. "tapetype.c"
> was only an extra program before it became promoted to amtapetype.
> That's probably why it was never tested that much on different OSes.
Good to see the clarifications, thanks.
I guess Julian was the first to build on SunOS since the promotion :)
--
Jon H. LaBadie jon AT jgcomp DOT com
JG Computing
4455 Province Line Road (609) 252-0159
Princeton, NJ 08540-4322 (609) 683-7220 (fax)
|