summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès2013-02-25 23:13:07 +0100
committerLudovic Courtès2013-02-25 23:13:07 +0100
commitcbddfe693932da1b93aee590ddae7d89d5f5dcc8 (patch)
tree73ee6015ccf6003f5377a2dec01320d0589bcb2c
parent5e0ab84f6196058a6f735100d3a0eff7fa9e9483 (diff)
downloadskribilo-cbddfe693932da1b93aee590ddae7d89d5f5dcc8.tar.gz
skribilo-cbddfe693932da1b93aee590ddae7d89d5f5dcc8.tar.lz
skribilo-cbddfe693932da1b93aee590ddae7d89d5f5dcc8.zip
Install the locale before parsing arguments, and handle `setlocale' errors.
* src/guile/skribilo.scm (skribilo): Install the locale before parsing options; gracefully handle `setlocale' errors.
-rw-r--r--src/guile/skribilo.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm
index 96faa3c..33c08fb 100644
--- a/src/guile/skribilo.scm
+++ b/src/guile/skribilo.scm
@@ -1,6 +1,6 @@
;;; skribilo.scm -- The Skribilo document processor.
;;;
-;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;
;;;
@@ -309,6 +309,15 @@ options."
;;;
(define (skribilo . args)
+ ;; Install the user-specified locale.
+ (catch 'system-error
+ (lambda _
+ (setlocale LC_ALL ""))
+ (lambda args
+ (format (current-error-port)
+ (_ "warning: failed to install locale: ~a~%")
+ (strerror (system-error-errno args)))))
+
(let* ((options (parse-args args))
(reader-name (string->symbol (assoc-ref options :reader)))
@@ -340,9 +349,6 @@ options."
;; The environment in which the document is evaluated.
(make-user-module (string->symbol compat)))
- ;; Install the user-specified locale.
- (setlocale LC_ALL "")
-
(if (> (*debug*) 4)
(set! %load-hook
(lambda (file)