[syslinux] port syslinux isohybrid perl script to C

H. Peter Anvin hpa at zytor.com
Mon Apr 12 08:54:22 PDT 2010


On 04/11/2010 11:27 AM, P J P wrote:
>   Hello all,
> 
> Past few days I was working on porting the isohybrid perl script to c.
> (-> https://fedorahosted.org/fedora-engineering-services/ticket/15)
> 
> The first patch towards the same is attached with this mail. The same could also be accessed
> 
> from: http://pjp.dgplug.org/tools/syslinux-3.86-isohybrid.patch
> 
> I would really appreciate it if somebody could have a look at it and let me know the feedback.
> 

a) Please don't use "unsigned short", "unsigned long", etc. for numbers
that need to be 16 and 32 bits, #include <inttypes.h> and use uint16_t,
uint32_t, etc.

b)    while ((n = getopt_long (argc, argv, optstr, lopt, &ind)) != -1)
                             ^- no spaces, please.

c)
+            sprintf (mbr, "%hhu%hhu%hhu%hhu%hhu%hhu%hhu%hhu%u%u", 0x80,
+                bhead, bsect, bcyle, type, ehead, esect, ecyle, offset,
psize);

This prints the ASCII representation of the respective numbers, but it's
supposed to output binary bytes!

I suggest actually testing this next time.

d)
+                sprintf (mbr++, "%c", '\0');

	memset()?

e)
+unsigned char hexdata[] = \

Let's see:

1) hard-codes the MBR files, instead of a Makefile flow to update them;

2) What use are the '*' byte separators when you can't rely on them
anyway (since 0x2a can appear anyway)...

	-hpa


	-hpa




More information about the Syslinux mailing list