Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
#include < unistd.h >
int execl(const char pathname, const char \*arg0, ... / NULL \*/);
int execv(const char \*pathname, char \*const argv\[\]);
int execle(const char pathname, const char \*arg0, ... / NULL, char \*const envp\[\] \*/);
int execve(const char \*pathname, char \*const argv\[\], char \*const envp\[\]);
int execlp(const char filename, const char \*arg0, ... / NULL \*/)
int execvp(const char \*filename, char \*const argv\[\]);
Code Block

\#include < sys/types.h >
\#include < sys/wait.h >
\#include < unistd.h >
char \*env_init\[\] = { "USER=unknown", "PATH=/tmp", NULL };
int main(void)
{
  pid_t pid;
  if ( (pid = fork()) < 0)
 perror("fork error");
  else if (pid == 0)
< 0) perror("execle error"); " >{ /\* specify pathnamepolku, specify environmentympäristö \*/
   if (execle("/bin", "echo", "myarg1", "MY ARG2", (char \*) 0, env_init) < 0)
               perror("execle error");
  }
  if (waitpid(pid, NULL, 0) < 0)
          perror("wait error");
  if ( (pid = fork()) < 0)
 perror("fork error");
  else if (pid == 0)
< 0) perror("execlp error"); " >{ /\* specify filenamepolku, inherit environmentympäristö \*/
   if (execlp("echo", "echo", "only 1 arg", (char \*) 0) < 0) perror("execlp error");
  }
  exit(0);
}