Fix handling of build-time grub-bin2h and grub-mkfont when doing

full Canadian cross. Tested with build=x86_64, host=arm,
	target=ppc-ieee1275.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-08-14 10:56:55 +02:00
parent 816719c8d4
commit 7c9d0c39af
9 changed files with 143 additions and 149 deletions

View file

@ -15,82 +15,19 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
static struct option options[] =
{
{"help", no_argument, 0, 'h' },
{"version", no_argument, 0, 'V' },
{0, 0, 0, 0 }
};
static void __attribute__ ((noreturn))
usage (int status)
{
if (status)
fprintf (stderr,
"Try ``%s --help'' for more information.\n", program_name);
else
printf ("\
Usage: %s [OPTIONS] SYMBOL-NAME\n\
\n\
Convert a binary file to a C header.\n\
\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
\n\
Report bugs to <%s>.\n\
", program_name, PACKAGE_BUGREPORT);
exit (status);
}
int
main (int argc, char *argv[])
{
int b, i;
char *sym;
set_program_name (argv[0]);
if (2 != argc)
return 1;
/* Check for options. */
while (1)
{
int c = getopt_long (argc, argv, "snm:r:hVv", options, 0);
if (c == -1)
break;
else
switch (c)
{
case 'h':
usage (0);
break;
case 'V':
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
default:
usage (1);
break;
}
}
if (optind >= argc)
usage (1);
if (optind + 1 != argc)
usage (1);
sym = argv[optind];
sym = argv[1];
b = getchar ();
if (b == EOF)

View file

@ -850,7 +850,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
{
FILE *file;
grub_uint32_t leng;
char style_name[20], *font_name;
char style_name[20], *font_name, *ptr;
int offset;
struct grub_glyph_info *cur;
@ -885,8 +885,13 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
if (! style_name[0])
strcpy (style_name, " Regular");
font_name = xasprintf ("%s %s %d", font_info->name, &style_name[1],
font_info->size);
font_name = xmalloc (strlen (font_info->name) + strlen (&style_name[1])
+ 3 + 20);
ptr = stpcpy (font_name, font_info->name);
*ptr++ = ' ';
ptr = stpcpy (ptr, &style_name[1]);
*ptr++ = ' ';
snprintf (ptr, 20, "%d", font_info->size);
write_string_section (FONT_FORMAT_SECTION_NAMES_FONT_NAME,
font_name, &offset, file, output_file);
@ -1210,9 +1215,9 @@ main (int argc, char *argv[])
arguments.font_index, &ft_face);
if (err)
{
grub_printf (_("can't open file %s, index %d: error %d"),
arguments.files[i],
arguments.font_index, err);
printf (_("can't open file %s, index %d: error %d"),
arguments.files[i],
arguments.font_index, err);
if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs))
printf (": %s\n", ft_errmsgs[err]);
else