#include "../SDL_sysurl.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
Go to the source code of this file.
◆ SDL_SYS_OpenURL()
| int SDL_SYS_OpenURL |
( |
const char * |
url | ) |
|
Definition at line 32 of file SDL_sysurl.c.
34 const pid_t pid1 = fork();
37 const pid_t pid2 = vfork();
39 execlp(
"xdg-open",
"xdg-open", url,
NULL);
41 }
else if (pid2 < 0) {
47 }
else if (pid1 < 0) {
48 return SDL_SetError(
"fork() failed: %s", strerror(errno));
51 if (waitpid(pid1, &status, 0) == pid1) {
52 if (WIFEXITED(status)) {
53 if (WEXITSTATUS(status) == 0) {
56 return SDL_SetError(
"xdg-open reported error or failed to launch: %d", WEXITSTATUS(status));
62 return SDL_SetError(
"Waiting on xdg-open failed: %s", strerror(errno));
References NULL, and SDL_SetError.