Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rochester!rutgers!lll-lcc!well!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.lang.c Subject: Re: Accessing argc & argv from a function Message-ID: <2616@hoptoad.uucp> Date: Mon, 3-Aug-87 07:34:16 EDT Article-I.D.: hoptoad.2616 Posted: Mon Aug 3 07:34:16 1987 Date-Received: Tue, 4-Aug-87 01:56:50 EDT References: <420@sugar.UUCP> <39@flmis06.ATT.COM> <1260@killer.UUCP> Organization: Nebula Consultants in San Francisco Lines: 20 > Well, I think we may have lost track of the initial problem. > > However I am still looking for a way to get at "argc" and "argv" from > a function when I don't have access to "main". There is no portable way to do this. Even if there was such a way, most main() programs are written to completely parse their arguments and to reject any that they don't understand. If you were hoping to sneak in extra arguments that your routine could parse later, you are probably out of luck. The solution is to get the source for main() and modify it, or do something that doesn't involve the arguments, e.g. pass the information you are looking for in the environment, in a file, etc. You never did get around to explaining what it is you *really* want to do, or why you are modifying subroutines' sources but don't have source to main(). -- {dasys1,ncoast,well,sun,ihnp4}!hoptoad!gnu gnu@postgres.berkeley.edu Alt.all: the alternative radio of the Usenet.