source:
git/Singular/feOpenWinntUrl.c
@
b787fb6
Last change on this file since b787fb6 was fdc537, checked in by , 24 years ago | |
---|---|
|
|
File size: 1.1 KB |
Line | |
---|---|
1 | /**************************************** |
2 | * Computer Algebra System SINGULAR * |
3 | ****************************************/ |
4 | /* |
5 | * ABSTRACT: encapsulation of call to Win32 ShellExecute call for opening |
6 | a URL |
7 | */ |
8 | |
9 | /* you can try this out by compiling with -DTEST and runing: |
10 | a.exe file|url [not-local]*/ |
11 | #ifdef WINNT |
12 | #include <windows.h> |
13 | |
14 | #ifndef MAXPATHLEN |
15 | #define MAXPATHLEN 1024 |
16 | #endif |
17 | |
18 | void heOpenWinntUrl(const char* url, int local) |
19 | { |
20 | #ifdef TEST |
21 | printf("url:%s:local:%d\n", url, local); |
22 | #endif |
23 | if (local) |
24 | { |
25 | char path[MAXPATHLEN]; |
26 | char *p; |
27 | cygwin_conv_to_full_win32_path(url, path); |
28 | /* seems like I can not open url's wit # at the end */ |
29 | if ((p=strchr(path, '#')) != NULL) *p = '\0'; |
30 | #ifdef TEST |
31 | printf("path:%s:local:%d\n", path, local); |
32 | #endif |
33 | ShellExecute(NULL, "open", path, 0, 0, SW_SHOWNORMAL); |
34 | } |
35 | else |
36 | { |
37 | // need to check whether this works |
38 | ShellExecute(NULL, "open", url, 0, 0, SW_SHOWNORMAL); |
39 | } |
40 | } |
41 | |
42 | #ifdef TEST |
43 | int main(int argc, char* argv[]) |
44 | { |
45 | heOpenWinntUrl(argv[1], argc > 2 ? 0 : 1); |
46 | } |
47 | #endif |
48 | #endif |
Note: See TracBrowser
for help on using the repository browser.