From cbddfe693932da1b93aee590ddae7d89d5f5dcc8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 25 Feb 2013 23:13:07 +0100 Subject: 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. --- src/guile/skribilo.scm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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 +;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012, 2013 Ludovic Courtès ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI ;;; ;;; @@ -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) -- cgit v1.2.3