Re: Command line arguments without argc and argv
From: Jirka Kosina (jikos_at_jikos.cz)
Date: 07/23/05
- Next message: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Previous message: Jirka Kosina: "Re: Command line arguments without argc and argv"
- In reply to: Jirka Kosina: "Re: Command line arguments without argc and argv"
- Next in thread: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Reply: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 23 Jul 2005 14:37:00 +0200
On Sat, 23 Jul 2005, Jirka Kosina wrote:
> If it doesn't work for you, then it probably needs some tuning to your
> version of glibc (and dynamic linker specifically)
> This is how it behvaes on my fedora box without stack randomization
Or even simpler guys, this is probably more portable :)
int main()
{
extern char **environ;
char *** argvp;
char ** argv;
char * s;
void * p;
asm ("mov %%esp, %0" : "=r" (p));
argvp = p;
while (*argvp != environ)
argvp++;
argvp--;
argv = *argvp;
for (s = *argv ; s ; s = *++argv)
printf("%s\n", s);
return 0;
}
-- JiKos.
- Next message: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Previous message: Jirka Kosina: "Re: Command line arguments without argc and argv"
- In reply to: Jirka Kosina: "Re: Command line arguments without argc and argv"
- Next in thread: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Reply: Kasper Dupont: "Re: Command line arguments without argc and argv"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|