self: Use a 'guile' that doesn't complain about locales.
[jackhill/guix/guix.git] / gnu / packages / aux-files / guile-launcher.c
1 /* GNU Guix --- Functional package management for GNU
2 Copyright 1996-1997,2000-2001,2006,2008,2011,2013,2018
3 Free Software Foundation, Inc.
4 Copyright (C) 2020 Ludovic Courtès <ludo@gnu.org>
5
6 This file is part of GNU Guix.
7
8 GNU Guix is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or (at
11 your option) any later version.
12
13 GNU Guix is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
20
21 /* This file implements a variant of the 'guile' executable that does not
22 complain about locale issues. */
23
24 #include <locale.h>
25 #include <libguile.h>
26
27 static void
28 inner_main (void *unused, int argc, char **argv)
29 {
30 scm_shell (argc, argv);
31 }
32
33 int
34 main (int argc, char **argv)
35 {
36 /* Try to install the current locale; remain silent if it fails. */
37 if (setlocale (LC_ALL, "") == NULL)
38 /* The 'guix pull'-provided 'guix' includes at least en_US.utf8 so use
39 that. That gives us UTF-8 support for 'scm_to_locale_string', etc.,
40 which is always preferable over the C locale. */
41 setlocale (LC_ALL, "en_US.utf8");
42
43 scm_install_gmp_memory_functions = 1;
44 scm_boot_guile (argc, argv, inner_main, 0);
45 return 0; /* never reached */
46 }