From owner-freebsd-questions Mon Feb 2 11:14:42 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA17406 for questions-outgoing; Mon, 2 Feb 1998 11:14:42 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from cam.grad.kiev.ua (grad-UTC-28k8.ukrtel.net [195.5.25.54]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA17343 for ; Mon, 2 Feb 1998 11:14:36 -0800 (PST) (envelope-from Ruslan@Shevchenko.kiev.ua) Received: from Shevchenko.kiev.ua (localhost [127.0.0.1]) by cam.grad.kiev.ua (8.8.8/8.8.5) with ESMTP id XAA14391; Sun, 1 Feb 1998 23:12:35 +0200 (EET) Message-ID: <34D4E539.2EC001E5@Shevchenko.kiev.ua> Date: Sun, 01 Feb 1998 23:12:28 +0200 From: Ruslan Shevchenko X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.5-STABLE i386) MIME-Version: 1.0 To: grobin@accessv.com CC: questions@FreeBSD.ORG Subject: Re: Can't getopt(). References: <34D6150D.2FD35180@accessv.com> Content-Type: text/plain; charset=x-user-defined Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe questions" Geoffrey Robinson wrote: > I probably shouldn't keep posting my C questions to this list but I'm > stumped on this command and don't know anybody who can help. > > The program below should print the first command line argument but when > I try to compile it I get the errors 'argc' undeclared and 'argv' > undeclared. I've been through the getopt man page dozens of times but I > can't see where it shows how to declare argc and argv. So if they're not > defined in stdlib.h I don't know where they come from. > > #include > #include > > main() > { > extern char *optarg; > extern int optind; > int ch = 0; > > ch = getopt(argc, argv, "abcdefghijklmnopqrstuvwxyz"); > printf ("%c\n",ch); > } > > At this point I'm so frustrated with this I would be happy with a way of > just getting the command line arguments as a single string and decode > them myself. > OR: main(int argc, char**argv) OR extern int _argc; extern char** _argv; which is not reccomended. > Thanks. > > -- > Geoffrey Robinson > grobin@accessv.com > Oakville, Ontario, Canada. -- @= //RSSH mailto://Ruslan@Shevchenko.Kiev.UA