Indentation fix, cleanup.
[AROS.git] / arch / all-pc / boot / grub2-aros / util / bin2h.c
blobdd75fb8b75a2b74fefddc0a5738585153dd1feb2
1 /*
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/>.
18 #include <stdio.h>
19 #include <stdlib.h>
21 int
22 main (int argc, char *argv[])
24 int b, i;
25 char *sym;
27 if (2 != argc)
28 return 1;
30 sym = argv[1];
32 b = getchar ();
33 if (b == EOF)
34 goto abort;
36 printf ("/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n"
37 "unsigned char %s[] =\n{\n", sym);
39 while (1)
41 printf ("0x%02x", b);
43 b = getchar ();
44 if (b == EOF)
45 goto end;
47 for (i = 0; i < 16 - 1; i++)
49 printf (", 0x%02x", b);
51 b = getchar ();
52 if (b == EOF)
53 goto end;
56 printf (",\n");
59 end:
60 printf ("\n};\n");
62 abort:
63 exit (0);