2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
14 #include <sys/types.h>
21 int filelength (int fd)
24 if (fstat (fd, &buf) == -1)
35 int platform_open_url(const char *url)
38 const char *open_cmd = "open";
40 const char *open_cmd = "xdg-open";
45 // make sure it's a valid www address
46 if ( !SDL_strncasecmp(url, "http://", 7) || !SDL_strncasecmp(url, "https://", 8) ) {
47 SDL_strlcpy(s_url, url, SDL_arraysize(s_url));
49 SDL_strlcpy(s_url, "http://", SDL_arraysize(s_url));
50 SDL_strlcat(s_url, url, SDL_arraysize(s_url));
56 // nothing, will return error
57 } else if (mpid == 0) {
60 rv = execlp(open_cmd, open_cmd, s_url, (char *)0);
64 waitpid(mpid, &statval, 0);
66 if ( WIFEXITED(statval) ) {
67 if (WEXITSTATUS(statval) == 0) {
78 unsigned int platform_get_kmod()