Skip to main content

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have appleapple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

But what is it used for? Well, Apple can use the apple vector to pass whatever "hidden" parameters they want to any program. And they do actually use it, too. Currently, apple[0] contains the path where the executing binary was found on disk. What's that you say? How is apple[0] different from argv[0]? The difference is that argv[0] can be set to any arbitrary value when execve(2) is called. For example, shells often differentiate a login shell from a regular shell by starting login shells with the first character in argv[0] being a -

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

But what is it used for? Well, Apple can use the apple vector to pass whatever "hidden" parameters they want to any program. And they do actually use it, too. Currently, apple[0] contains the path where the executing binary was found on disk. What's that you say? How is apple[0] different from argv[0]? The difference is that argv[0] can be set to any arbitrary value when execve(2) is called. For example, shells often differentiate a login shell from a regular shell by starting login shells with the first character in argv[0] being a -

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

But what is it used for? Well, Apple can use the apple vector to pass whatever "hidden" parameters they want to any program. And they do actually use it, too. Currently, apple[0] contains the path where the executing binary was found on disk. What's that you say? How is apple[0] different from argv[0]? The difference is that argv[0] can be set to any arbitrary value when execve(2) is called. For example, shells often differentiate a login shell from a regular shell by starting login shells with the first character in argv[0] being a -

added 545 characters in body
Source Link
Shafik Yaghmour
  • 159.8k
  • 44
  • 466
  • 778

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

But what is it used for? Well, Apple can use the apple vector to pass whatever "hidden" parameters they want to any program. And they do actually use it, too. Currently, apple[0] contains the path where the executing binary was found on disk. What's that you say? How is apple[0] different from argv[0]? The difference is that argv[0] can be set to any arbitrary value when execve(2) is called. For example, shells often differentiate a login shell from a regular shell by starting login shells with the first character in argv[0] being a -

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

But what is it used for? Well, Apple can use the apple vector to pass whatever "hidden" parameters they want to any program. And they do actually use it, too. Currently, apple[0] contains the path where the executing binary was found on disk. What's that you say? How is apple[0] different from argv[0]? The difference is that argv[0] can be set to any arbitrary value when execve(2) is called. For example, shells often differentiate a login shell from a regular shell by starting login shells with the first character in argv[0] being a -

added 22 characters in body
Source Link
Shafik Yaghmour
  • 159.8k
  • 44
  • 466
  • 778

You may be able to use the non-portable envpenvp argument to mainmain:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have appleapple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

You may be able to use envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 

You may be able to use the non-portable envp argument to main:

int main(int argc,char* argv[], char** envp) 

and as a bonus apparently on OSX you have apple which gives you other OS supplied info:

int main(int argc, char **argv, char **envp, char **apple) 
added 165 characters in body
Source Link
Shafik Yaghmour
  • 159.8k
  • 44
  • 466
  • 778
Loading
Source Link
Shafik Yaghmour
  • 159.8k
  • 44
  • 466
  • 778
Loading