If you are porting System V Interface Definition (SVID) code, you might need to be careful of the process environment. Instead of the process environment being defined as a third argument to main(), it is defined as extern char **environ.
When you modify the environment for the current process, you can use getenv() and putenv(). When you modify the environment to be passed to a child process, you can use getenv(), setenv(), and putenv(), or you can build a new environment and pass it to the child using the envp argument of exec().