Allow implicit cast from null to maybe types ("Type?")
[delight/core.git] / dmd / man.c
blob7d3bacd5d6ca65ee86b3b08565e8f7f7c06830fb
2 // Compiler implementation of the D programming language
3 // Copyright (c) 2008-2008 by Digital Mars
4 // All Rights Reserved
5 // written by Walter Bright
6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 // See the included readme.txt for details.
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdlib.h>
14 #include <assert.h>
16 #if _WIN32
18 #include <windows.h>
20 #pragma comment(lib,"shell32.lib")
22 void browse(const char *url)
24 ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
27 #endif
29 #if linux
31 #include <sys/types.h>
32 #include <sys/wait.h>
33 #include <unistd.h>
35 void browse(const char *url)
37 pid_t childpid;
38 const char *args[3];
40 char *browser = getenv("BROWSER");
41 if (browser)
42 browser = strdup(browser);
43 else
44 browser = "firefox";
46 args[0] = browser;
47 args[1] = url;
48 args[2] = NULL;
50 childpid = fork();
51 if (childpid == 0)
53 execvp(args[0], (char**)args);
54 perror(args[0]); // failed to execute
55 return;
59 #endif