source: git/Singular/feOpenWinntUrl.c @ 3845c1

spielwiese
Last change on this file since 3845c1 was 3845c1, checked in by Olaf Bachmann <obachman@…>, 24 years ago
added git-svn-id: file:///usr/local/Singular/svn/trunk@4294 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
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
18heOpenWinntUrl(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
43int 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.