2 * Copyright (C) 2008,2010 Free Software Foundation, Inc.
4 * GRUB is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * GRUB is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
27 static struct option options
[] =
29 {"help", no_argument
, 0, 'h' },
30 {"version", no_argument
, 0, 'V' },
39 "Try ``%s --help'' for more information.\n", program_name
);
42 Usage: %s [OPTIONS] SYMBOL-NAME\n\
44 Convert a binary file to a C header.\n\
46 -h, --help display this message and exit\n\
47 -V, --version print version information and exit\n\
49 Report bugs to <%s>.\n\
50 ", program_name
, PACKAGE_BUGREPORT
);
56 main (int argc
, char *argv
[])
61 set_program_name (argv
[0]);
63 /* Check for options. */
66 int c
= getopt_long (argc
, argv
, "snm:r:hVv", options
, 0);
78 printf ("%s (%s) %s\n", program_name
, PACKAGE_NAME
, PACKAGE_VERSION
);
90 if (optind
+ 1 != argc
)
99 printf ("/* THIS CHUNK OF BYTES IS AUTOMATICALY GENERATED */\n"
100 "unsigned char %s[] =\n{\n", sym
);
104 printf ("0x%02x", b
);
110 for (i
= 0; i
< 16 - 1; i
++)
112 printf (", 0x%02x", b
);