Mercurial > projects > ldc
annotate dmd/man.c @ 837:331a176c1f4f
Removed error on naked, not fully complete, but I'll be doing more work on it during this Christmas, and some things do work.
Fixed taking delegate of final class method. see mini/delegate3.d.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 09 Dec 2008 14:07:30 +0100 |
parents | f79bbd1d0b27 |
children | 330f999ade44 |
rev | line source |
---|---|
337 | 1 |
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. | |
10 | |
11 #include <stdio.h> | |
12 #include <string.h> | |
13 #include <stdlib.h> | |
14 #include <assert.h> | |
15 | |
16 #if _WIN32 | |
17 | |
18 #include <windows.h> | |
19 | |
20 #pragma comment(lib,"shell32.lib") | |
21 | |
22 void browse(const char *url) | |
23 { | |
24 ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); | |
25 } | |
26 | |
27 #endif | |
28 | |
535
f79bbd1d0b27
Add __APPLE__ to most #if linux compile time switches.
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
337
diff
changeset
|
29 #if linux || __APPLE__ |
337 | 30 |
31 #include <sys/types.h> | |
32 #include <sys/wait.h> | |
33 #include <unistd.h> | |
34 | |
35 void browse(const char *url) | |
36 { | |
37 pid_t childpid; | |
38 const char *args[3]; | |
39 | |
40 char *browser = getenv("BROWSER"); | |
41 if (browser) | |
42 browser = strdup(browser); | |
43 else | |
44 browser = "firefox"; | |
45 | |
46 args[0] = browser; | |
47 args[1] = url; | |
48 args[2] = NULL; | |
49 | |
50 childpid = fork(); | |
51 if (childpid == 0) | |
52 { | |
53 execvp(args[0], (char**)args); | |
54 perror(args[0]); // failed to execute | |
55 return; | |
56 } | |
57 } | |
58 | |
59 #endif | |
60 |