OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [libgui/] [library/] [internet.tcl] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#
2
# internet.tcl - tcl interface to various internet functions
3
#
4
# Copyright (C) 1998 Cygnus Solutions
5
# 
6
 
7
# ------------------------------------------------------------------
8
#  send_mail - send email
9
# ------------------------------------------------------------------
10
 
11
proc send_mail {to subject body} {
12
  global tcl_platform
13
 
14
  switch -- $tcl_platform(platform) {
15
    windows {
16
      ide_mapi simple-send $to $subject $body
17
    }
18
    unix {
19
      exec echo $body | mail -s $subject $to &
20
    }
21
    default {
22
      error "platform \"$tcl_platform(platform)\" not supported"
23
    }
24
  }
25
}
26
 
27
# ------------------------------------------------------------------
28
#  open_url - open a URL in a browser
29
#  Netscape must be available for Unix.
30
# ------------------------------------------------------------------
31
 
32
proc open_url {url} {
33
  global tcl_platform
34
  switch -- $tcl_platform(platform) {
35
    windows {
36
      ide_shell_execute open $url
37
      # FIXME.  can we detect errors?
38
    }
39
    unix {
40
      if {[catch "exec netscape -remote [list openURL($url,new-window)]" result]} {
41
        if {[string match {*not running on display*} $result]} {
42
          # Netscape is not running.  Try to start it.
43
          if {[catch "exec netscape [list $url] &" result]} {
44
            tk_dialog .warn "Netscape Error" "$result" error 0 Ok
45
            return 0
46
          }
47
        } elseif {[string match {couldn't execute *} $result]} {
48
          tk_dialog .warn "Netscape Error" "Cannot locate \"netscape\" on your system.\nIt must be installed and in your path." error 0 Ok
49
          return 0
50
        } else {
51
          tk_dialog .warn "Netscape Error" "$result" error 0 Ok
52
          return 0
53
        }
54
      }
55
    }
56
    default {
57
      error "platform \"$tcl_platform(platform)\" not supported"
58
      return 0
59
    }
60
  }
61
  return 1
62
}
63
 
64
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.