Julian C H Stevens wrote:
Thanks for the tip, John.
My getopt man page states that getopts is preferred, so I have
modified the source to use getopts instead. I am re-running make but,
as you may have guessed, my sun workstation is a little s-l-o-w!
...I'll report back when its finished.
Nonono. That is the shell utility getopts vs getopt.
Do "man 3 getopt" to get the page for the C library routines.
And there you find:
SYNOPSIS
int getopt(argc, argv, optstring)
int argc;
char **argv;
char *optstring;
extern char *optarg;
extern int optind, opterr;
So what you need actually is a definition for optind, that seems
to be missing:
Add somewhere in main() or outside it the defintion:
extern int optind;
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.)
--
Paul Bijnens, Xplanation Tel +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512
http://www.xplanation.com/ email: Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, *
* kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ... "Are you sure?" ... YES ... Phew ... I'm out *
***********************************************************************
|