]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Move set_program_name and init_nls to host_init. On windows
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 13 Oct 2013 18:03:42 +0000 (20:03 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 13 Oct 2013 18:03:42 +0000 (20:03 +0200)
fix in this fuction console and argument charset as well.

24 files changed:
ChangeLog
Makefile.util.def
grub-core/kern/emu/main.c
grub-core/osdep/basic/init.c [new file with mode: 0644]
grub-core/osdep/init.c [new file with mode: 0644]
grub-core/osdep/windows/getroot.c
grub-core/osdep/windows/hostdisk.c
grub-core/osdep/windows/init.c [new file with mode: 0644]
include/grub/util/misc.h
util/grub-editenv.c
util/grub-fstest.c
util/grub-glue-efi.c
util/grub-menulst2cfg.c
util/grub-mkfont.c
util/grub-mkimage.c
util/grub-mklayout.c
util/grub-mkpasswd-pbkdf2.c
util/grub-mkrelpath.c
util/grub-mount.c
util/grub-probe.c
util/grub-render-label.c
util/grub-script-check.c
util/grub-setup.c
util/ieee1275/grub-ofpathname.c

index cafb6494efb14052419b6e9f646aae0abed103b6..0b19f15f6d4fa9e8c0ab6a94c71fef2664da159c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-13  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Move set_program_name and init_nls to host_init. On windows
+       fix in this fuction console and argument charset as well.
+
 2013-10-12  Andrey Borzenkov <arvidjaar@gmail.com>
 
        Fix inconsistent use of GRUB_CRYPTODISK_ENABLE and
index a42562627647f500bd777977c64db87ab4cac575..6146445429ddd047717adc4b98f2923ca65c876c 100644 (file)
@@ -162,6 +162,7 @@ program = {
   common = util/grub-mkimage.c;
   common = util/resolve.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   common = grub-core/kern/arm/dl_helper.c;
 
@@ -182,6 +183,7 @@ program = {
 
   common = util/grub-mkrelpath.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -196,6 +198,7 @@ program = {
 
   common = util/grub-script-check.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -209,6 +212,7 @@ program = {
   mansection = 1;
 
   common = util/grub-editenv.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -224,6 +228,7 @@ program = {
   common = util/grub-mkpasswd-pbkdf2.c;
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/osdep/random.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -246,6 +251,7 @@ program = {
   common = util/grub-fstest.c;
   common = grub-core/kern/emu/hostfs.c;
   common = grub-core/disk/host.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -274,18 +280,18 @@ program = {
   name = grub-mkfont;
   mansection = 1;
   common = util/grub-mkfont.c;
-  common = grub-core/unidata.c;
   common = grub-core/kern/emu/argp_common.c;
-  common = grub-core/kern/emu/misc.c;
-  common = util/misc.c;
-  common = grub-core/gnulib/progname.c;
+  common = grub-core/osdep/init.c;
 
   cflags = '$(freetype_cflags)';
   cppflags = '-DGRUB_MKFONT=1';
 
+  ldadd = libgrubmods.a;
+  ldadd = libgrubgcry.a;
+  ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
   ldadd = '$(freetype_libs)';
-  ldadd = '$(LIBINTL)';
+  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
   condition = COND_GRUB_MKFONT;
 };
 
@@ -296,6 +302,7 @@ program = {
   common = util/grub-probe.c;
   common = grub-core/osdep/ofpath.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -311,6 +318,7 @@ program = {
   common = util/grub-setup.c;
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/lib/reed_solomon.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubkern.a;
@@ -328,6 +336,7 @@ program = {
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/lib/reed_solomon.c;
   common = grub-core/osdep/ofpath.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubkern.a;
@@ -343,6 +352,7 @@ program = {
   mansection = 8;
   common = util/ieee1275/grub-ofpathname.c;
   common = grub-core/osdep/ofpath.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -357,6 +367,7 @@ program = {
 
   common = util/grub-mklayout.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -904,6 +915,7 @@ program = {
   common = util/grub-menulst2cfg.c;
   common = grub-core/lib/legacy_parse.c;
   common = grub-core/lib/i386/pc/vesa_modes_table.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -918,6 +930,7 @@ program = {
 
   common = util/grub-glue-efi.c;
   common = grub-core/kern/emu/argp_common.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
@@ -934,6 +947,7 @@ program = {
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/kern/emu/hostfs.c;
   common = grub-core/disk/host.c;
+  common = grub-core/osdep/init.c;
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
index b8857fd6b0e02563fee3d6509d7e5be8a5e05acd..49e17f15d88efb0e1aa63c627d2d066156ad767d 100644 (file)
@@ -180,7 +180,7 @@ main (int argc, char *argv[])
     };
   volatile int hold = 0;
 
-  set_program_name (argv[0]);
+  grub_util_host_init (&argc, &argv);
 
   dir = xstrdup (DEFAULT_DIRECTORY);
 
diff --git a/grub-core/osdep/basic/init.c b/grub-core/osdep/basic/init.c
new file mode 100644 (file)
index 0000000..d01725f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2013  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <config-util.h>
+
+#include <grub/util/misc.h>
+
+#include "progname.h"
+
+void
+grub_util_host_init (int *argc __attribute__ ((unused)),
+                    char ***argv)
+{
+  set_program_name ((*argv)[0]);
+
+  grub_util_init_nls ();
+}
diff --git a/grub-core/osdep/init.c b/grub-core/osdep/init.c
new file mode 100644 (file)
index 0000000..207f670
--- /dev/null
@@ -0,0 +1,5 @@
+#if defined (__MINGW32__)
+#include "windows/init.c"
+#else
+#include "basic/init.c"
+#endif
index 56756555c12322f23190b845e1f2f6cacdaefd48..d86d0774d9f11feabd4ca4e2127f49d27e15765b 100644 (file)
 #include <windows.h>
 #include <winioctl.h>
 
-char *
-grub_util_tchar_to_utf8 (LPCTSTR in)
-{
-#if SIZEOF_TCHAR == 1
-  return xstrdup (path);
-#elif SIZEOF_TCHAR == 2
-  size_t ssz;
-  for (ssz = 0; in[ssz]; ssz++);
-
-  size_t tsz = GRUB_MAX_UTF8_PER_UTF16 * ssz + 1;
-  grub_uint8_t *ret = xmalloc (tsz);
-  *grub_utf16_to_utf8 (ret, in, ssz) = '\0';
-  return (char *) ret;
-#else
-#error "Unsupported TCHAR size"
-#endif
-}
-
 #if SIZEOF_TCHAR == 1
 #define tcsnicmp strncasecmp
 #define tclen strlen
index 5f0fc542534cbbf56a541b5443573ac8615ad84a..42b58fbabda69ba160b6ea6e160214ae058f535f 100644 (file)
 #include <windows.h>
 #include <winioctl.h>
 
+#if SIZEOF_TCHAR == 1
+
+LPTSTR
+grub_util_utf8_to_tchar (const char *in)
+{
+  return xstrdup (in);
+}
+
+char *
+grub_util_tchar_to_utf8 (LPCTSTR in)
+{
+  return xstrdup (in);
+}
+
+#elif SIZEOF_TCHAR == 2
+
+LPTSTR
+grub_util_utf8_to_tchar (const char *in)
+{
+  LPTSTR ret;
+  size_t ssz = strlen (in);
+  size_t tsz = 2 * (GRUB_MAX_UTF16_PER_UTF8 * ssz + 1);
+  ret = xmalloc (tsz);
+  tsz = grub_utf8_to_utf16 (ret, tsz,
+                           (const grub_uint8_t *) in, ssz, NULL);
+  ret[tsz] = 0;
+  return ret;
+}
+
+char *
+grub_util_tchar_to_utf8 (LPCTSTR in)
+{
+  size_t ssz;
+  for (ssz = 0; in[ssz]; ssz++);
+
+  size_t tsz = GRUB_MAX_UTF8_PER_UTF16 * ssz + 1;
+  grub_uint8_t *ret = xmalloc (tsz);
+  *grub_utf16_to_utf8 (ret, in, ssz) = '\0';
+  return (char *) ret;
+}
+
+#else
+#error "Unsupported TCHAR size"
+#endif
+
 #ifdef __CYGWIN__
 LPTSTR
 grub_util_get_windows_path (const char *path)
@@ -64,28 +109,20 @@ grub_util_get_windows_path (const char *path)
 LPTSTR
 grub_util_get_windows_path (const char *path)
 {
-  char *fpa;
-  const char *fp;
-  LPTSTR ret;
+  LPTSTR fpa;
+  LPTSTR tpath;
 
-  fp = fpa = xmalloc (PATH_MAX);
-  if (!_fullpath (fpa, path, PATH_MAX))
-    fp = path;
-#if SIZEOF_TCHAR == 1
-  ret = xstrdup (fp);
-#elif SIZEOF_TCHAR == 2
-  size_t ssz = strlen (fp);
-  size_t tsz = 2 * (GRUB_MAX_UTF16_PER_UTF8 * ssz + 1);
-  ret = xmalloc (tsz);
-  tsz = grub_utf8_to_utf16 (ret, tsz, (const grub_uint8_t *) fp, ssz, NULL);
-  ret[tsz] = 0;
-#else
-#error SIZEOF_TCHAR
-#error "Unsupported TCHAR size"
-#endif
+  tpath = grub_util_utf8_to_tchar (path);
 
-  free (fpa);
-  return ret;
+  fpa = xmalloc (PATH_MAX * sizeof (fpa[0]));
+  if (!_wfullpath (fpa, tpath, PATH_MAX))
+    {
+      free (fpa);
+      return tpath;
+    }
+
+  free (tpath);
+  return fpa;
 }
 #endif
 
diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c
new file mode 100644 (file)
index 0000000..e6ad301
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2013  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <config-util.h>
+#include <grub/util/misc.h>
+#include <grub/osdep/hostfile.h>
+#include <grub/util/windows.h>
+
+#include <wincon.h>
+#include <windows.h>
+
+#include <grub/util/misc.h>
+
+#include "progname.h"
+
+struct grub_windows_console_font_infoex {
+  ULONG cbSize;
+  DWORD nFont;
+  COORD dwFontSize;
+  UINT  FontFamily;
+  UINT  FontWeight;
+  WCHAR FaceName[LF_FACESIZE];
+};
+
+static int
+check_is_raster (HMODULE kernel32, HANDLE hnd)
+{
+  CONSOLE_FONT_INFO console_font_info;
+  BOOL (WINAPI * func_GetCurrentConsoleFont) (HANDLE, BOOL,
+                                             PCONSOLE_FONT_INFO);
+
+  func_GetCurrentConsoleFont = (void *)
+    GetProcAddress (kernel32, "GetCurrentConsoleFont");
+
+  if (!func_GetCurrentConsoleFont)
+    return 1;
+
+  if (!func_GetCurrentConsoleFont (hnd, FALSE, &console_font_info))
+    return 1;
+  return console_font_info.nFont < 12;
+}
+
+static void
+set_console_unicode_font (void)
+{
+  BOOL (WINAPI * func_SetCurrentConsoleFontEx) (HANDLE, BOOL,
+                                               struct grub_windows_console_font_infoex *);
+  BOOL (WINAPI * func_SetConsoleFont)(HANDLE, DWORD);
+  HMODULE kernel32;
+  HANDLE out_handle = GetStdHandle (STD_OUTPUT_HANDLE);
+  HANDLE err_handle = GetStdHandle (STD_ERROR_HANDLE);
+  int out_raster, err_raster;
+
+  kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+  if (!kernel32)
+    return;
+
+  out_raster = check_is_raster (kernel32, out_handle);
+  err_raster = check_is_raster (kernel32, err_handle);
+
+  if (!out_raster && !err_raster)
+    return;
+
+  func_SetCurrentConsoleFontEx = (void *) GetProcAddress (kernel32, "SetCurrentConsoleFontEx");
+
+  /* Newer windows versions.  */
+  if (func_SetCurrentConsoleFontEx)
+    {
+      struct grub_windows_console_font_infoex new_console_font_info;
+      new_console_font_info.cbSize = sizeof (new_console_font_info);
+      new_console_font_info.nFont = 12;
+      new_console_font_info.dwFontSize.X = 7;
+      new_console_font_info.dwFontSize.Y = 12;
+      new_console_font_info.FontFamily = FF_DONTCARE;
+      new_console_font_info.FontWeight = 400;
+      memcpy (new_console_font_info.FaceName, TEXT("Lucida Console"),
+             sizeof (TEXT("Lucida Console")));
+      if (out_raster)
+       func_SetCurrentConsoleFontEx (out_handle, FALSE,
+                                     &new_console_font_info);
+      if (err_raster)
+       func_SetCurrentConsoleFontEx (err_handle, FALSE,
+                                     &new_console_font_info);
+      return;
+    }
+
+  /* Fallback for older versions.  */
+  func_SetConsoleFont = (void *) GetProcAddress (kernel32, "SetConsoleFont");
+  if (func_SetConsoleFont)
+    {
+      if (out_raster)
+       func_SetConsoleFont (out_handle, 12);
+      if (err_raster)
+       func_SetConsoleFont (err_handle, 12);
+    }
+}
+
+void
+grub_util_host_init (int *argc __attribute__ ((unused)),
+                    char ***argv)
+{
+  SetConsoleOutputCP (CP_UTF8);
+  SetConsoleCP (CP_UTF8);
+
+  set_console_unicode_font ();
+
+#if SIZEOF_TCHAR == 1
+
+#elif SIZEOF_TCHAR == 2
+  LPWSTR tcmdline = GetCommandLineW ();
+  int i;
+  LPWSTR *targv;
+
+  targv = CommandLineToArgvW (tcmdline, argc);
+  *argv = xmalloc ((*argc + 1) * sizeof (argv[0]));
+
+  for (i = 0; i < *argc; i++)
+    (*argv)[i] = grub_util_tchar_to_utf8 (targv[i]); 
+  (*argv)[i] = NULL;
+#else
+#error "Unsupported TCHAR size"
+#endif
+
+  set_program_name ((*argv)[0]);
+
+  grub_util_init_nls ();
+}
index 232b920298bbfeedbc6cd8d0d6baacebf2ecf1bc..6aacf237ab79b057628ddbc659936c2c8ef7e6f3 100644 (file)
@@ -45,4 +45,6 @@ char *canonicalize_file_name (const char *path);
 
 void grub_util_init_nls (void);
 
+void grub_util_host_init (int *argc, char ***argv);
+
 #endif /* ! GRUB_UTIL_MISC_HEADER */
index 55206bcc6931649022a1d53f62f6bd3784a713fa..7da3fd4a9ddb3d39da624def1544f94db33d7a0c 100644 (file)
@@ -274,6 +274,8 @@ main (int argc, char *argv[])
   char *command;
   int curindex, arg_count;
 
+  grub_util_host_init (&argc, &argv);
+
   set_program_name (argv[0]);
 
   grub_util_init_nls ();
index 5c13a58fc9bea1eabe912c7abc98a68407d08c11..e6fe3c84f167a80acf1bc82edf93db2605e53b2f 100644 (file)
@@ -733,9 +733,7 @@ main (int argc, char *argv[])
   const char *default_root;
   char *alloc_root;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   args = xmalloc (argc * sizeof (args[0]));
 
index 47e393a1fad25b710a0f7f473bc3813db6c17e5a..edc4946b85cd3c1062302a7e895b9c9d2614ce23 100644 (file)
@@ -168,7 +168,7 @@ main (int argc, char *argv[])
   FILE *in32, *in64, *out;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
+  grub_util_host_init (&argc, &argv);
 
   /* Check for options.  */
   memset (&arguments, 0, sizeof (struct arguments));
index 915135d175f0fad86deb90241856e2f178ec037d..ee9b7811216dd24a260641717e29a4c8e4564c04 100644 (file)
@@ -37,6 +37,8 @@ main (int argc, char **argv)
   int suffixlen = 0;
   const char *out_fname = 0;
 
+  grub_util_host_init (&argc, &argv);
+
   if (argc >= 2 && argv[1][0] == '-')
     {
       fprintf (stdout, _("Usage: %s [INFILE [OUTFILE]]\n"), argv[0]);
index 76ccb26ed2ad02d8dcc7b177855944ed2df099c2..6532a79b7a68e4f69acfbe2cc78fbcd47b39b7b4 100644 (file)
@@ -1155,11 +1155,9 @@ main (int argc, char *argv[])
   struct arguments arguments;
 
 #ifndef GRUB_BUILD
-  set_program_name (argv[0]);
+  grub_util_host_init (&argc, &argv);
 #endif
 
-  grub_util_init_nls ();
-
   memset (&arguments, 0, sizeof (struct arguments));
   arguments.file_format = PF2;
   arguments.files_max = argc + 1;
index 2999ff2ed4622b99ce10f1d0bb84cbb0b613829f..b606bad760002f1e02a0f839914a17bc2f6b7c93 100644 (file)
@@ -2025,9 +2025,7 @@ main (int argc, char *argv[])
   FILE *fp = stdout;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   memset (&arguments, 0, sizeof (struct arguments));
   arguments.comp = COMPRESSION_AUTO;
index e53d7109aafe3acaeec4bf827000b223a5767774..8f8f3a8cb935587f4e914ffc80b18a969eb4da1a 100644 (file)
@@ -471,7 +471,7 @@ main (int argc, char *argv[])
   FILE *in, *out;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
+  grub_util_host_init (&argc, &argv);
 
   /* Check for options.  */
   memset (&arguments, 0, sizeof (struct arguments));
index 88be4a2e86b6f4181ee4343d1e55b617e9bd66be..5f30c587eaeced65a3e2e7479fe7b163c65c7a33 100644 (file)
@@ -119,9 +119,7 @@ main (int argc, char *argv[])
   char pass1[GRUB_AUTH_MAX_PASSLEN];
   char pass2[GRUB_AUTH_MAX_PASSLEN];
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   /* Check for options.  */
   if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
index 1e0c42f83b39b1db2f250bc6aff7a05e3e8176d5..6e64accd03e12c12672597c0e9c5e05873279595 100644 (file)
@@ -82,9 +82,7 @@ main (int argc, char *argv[])
   char *relpath;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   memset (&arguments, 0, sizeof (struct arguments));
 
index 4a2333ac0d738f80f2cc90e5b176488dedab2abf..f13bc0c0ccd6bc941943016dfd5c3aaa25f8fb6c 100644 (file)
@@ -541,9 +541,7 @@ main (int argc, char *argv[])
   const char *default_root;
   char *alloc_root;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
   fuse_args[fuse_argc] = xstrdup (argv[0]);
index a7e43739908366d9e09ea651b7e0211bd0346c0a..22d89842d5c75897593ae8fd9dc89972a23e203c 100644 (file)
@@ -910,9 +910,7 @@ main (int argc, char *argv[])
   char delim;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   memset (&arguments, 0, sizeof (struct arguments));
   arguments.device_max = argc + 1;
index 2af7eff132a59478fe4d4644087a9974b96f8e95..c809a981d3baef4e48984d39cf2187367d29aea3 100644 (file)
@@ -208,9 +208,7 @@ main (int argc, char *argv[])
   ieee1275_palette[cptr].b = 0;
   ieee1275_palette[cptr].a = 0xff;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   /* Check for options.  */
   memset (&arguments, 0, sizeof (struct arguments));
index d5e87839161cd80279650cf8660d778a96660950..9372bdd0f6d95b87a2be8742619e6871bb946c9c 100644 (file)
@@ -146,8 +146,7 @@ main (int argc, char *argv[])
   int found_input = 0, found_cmd = 0;
   struct grub_script *script = NULL;
 
-  set_program_name (argv[0]);
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   memset (&ctx.arguments, 0, sizeof (struct arguments));
 
index 3cbe81f135a34428b02be02ea7b76e39314e5abe..65d4fb8996267d81c4602cb3af3a108997d50938 100644 (file)
@@ -1138,9 +1138,7 @@ main (int argc, char *argv[])
   char *dest_dev = NULL;
   struct arguments arguments;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   /* Default option values. */
   memset (&arguments, 0, sizeof (struct arguments));
index 20a2ae120b9d48f06352a7a4330935f629387e5d..8e5d766cb63871c1479a42626c8cfa7fddd6f771 100644 (file)
@@ -32,9 +32,7 @@ int main(int argc, char **argv)
 {
   char *of_path;
 
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
+  grub_util_host_init (&argc, &argv);
 
   if (argc != 2 || strcmp (argv[1], "--help") == 0)
     {