slib.scm 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;;;; slib.scm --- SLIB interface shim
  2. ;;;;
  3. ;;;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
  4. ;;;;
  5. ;;;; This file is part of GUILE.
  6. ;;;;
  7. ;;;; GUILE is free software; you can redistribute it and/or modify it
  8. ;;;; under the terms of the GNU General Public License as published by
  9. ;;;; the Free Software Foundation; either version 2, or (at your
  10. ;;;; option) any later version.
  11. ;;;;
  12. ;;;; GUILE is distributed in the hope that it will be useful, but
  13. ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. ;;;; General Public License for more details.
  16. ;;;;
  17. ;;;; You should have received a copy of the GNU General Public License
  18. ;;;; along with GUILE; see the file COPYING. If not, write to the
  19. ;;;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20. ;;;; Boston, MA 02110-1301 USA
  21. ;;;;
  22. ;;;; As a special exception, the Free Software Foundation gives permission
  23. ;;;; for additional uses of the text contained in its release of GUILE.
  24. ;;;;
  25. ;;;; The exception is that, if you link the GUILE library with other files
  26. ;;;; to produce an executable, this does not by itself cause the
  27. ;;;; resulting executable to be covered by the GNU General Public License.
  28. ;;;; Your use of that executable is in no way restricted on account of
  29. ;;;; linking the GUILE library code into it.
  30. ;;;;
  31. ;;;; This exception does not however invalidate any other reasons why
  32. ;;;; the executable file might be covered by the GNU General Public License.
  33. ;;;;
  34. ;;;; This exception applies only to the code released by the
  35. ;;;; Free Software Foundation under the name GUILE. If you copy
  36. ;;;; code from other Free Software Foundation releases into a copy of
  37. ;;;; GUILE, as the General Public License permits, the exception does
  38. ;;;; not apply to the code that you add in this way. To avoid misleading
  39. ;;;; anyone as to the status of such modified files, you must delete
  40. ;;;; this exception notice from them.
  41. ;;;;
  42. ;;;; If you write modifications of your own for GUILE, it is your choice
  43. ;;;; whether to permit this exception to apply to your modifications.
  44. ;;;; If you do not wish that, delete this exception notice.
  45. ;;;;
  46. (if (and (defined? '*guile-use-old-ice-9-slib*) *guile-use-old-ice-9-slib*)
  47. (load-from-path "ice-9/slib-old.scm")
  48. (begin
  49. ;; The goal here is to eventually *only* rely on guile.init and
  50. ;; communicate any needed fixes upstream, but for now, we still
  51. ;; need to do a bit of the work here.
  52. ;;
  53. ;; At some point, we will probably just want to require a "new
  54. ;; enough" version of slib (perhaps with Guile 1.8). In that
  55. ;; case, we'll probably just load guile.init, and then test the
  56. ;; version.
  57. ;; These can be removed if/when we require a "new enough"
  58. ;; version of SLIB.
  59. (define-module (ice-9 slib))
  60. (provide 'hash)
  61. (load-from-path "slib/guile.init")
  62. ;; This can be removed if/when we require a "new enough" version of SLIB.
  63. (if (not (defined? 'browse-url))
  64. ;; Nothing special to do for this, so straight from
  65. ;; Template.scm. Maybe "sensible-browser" for a debian
  66. ;; system would be worth trying too (and would be good on a
  67. ;; tty).
  68. (define-public (browse-url url)
  69. (define (try cmd end) (zero? (system (string-append cmd url end))))
  70. (or (try "netscape-remote -remote 'openURL(" ")'")
  71. (try "netscape -remote 'openURL(" ")'")
  72. (try "netscape '" "'&")
  73. (try "netscape '" "'"))))))