how to parse input script of a transaction in blkzzzz.dat file? In data files, an input script of a transaction appears to be in this form:

[funky byte 1][signature][funky byte 2][public key]

Bitcoind displays an input script in this shape:

[signature][blank space][public key]

My questions are:

1. In general, how should I parse an input script?

2. What are the funky bytes?

3. How should I interpret/recognize the funky bytes during parsing?
The funky bytes, as you call them, are data-pushing op codes.  The wiki has a complete list of op codes.

For example, the op code before a signature is probably OP_71 (0x47) which pushes 71 bytes to the stack as data.  Without these data-pushing codes, there would be no way for Bitcoin to tell the difference between an arbitrary sequence of bytes (such as a signature) and op codes which need to be evaluated.

Parsing is simple:


The first byte is an op code.  Read it and do what it says.  If it's a data-pushing op code, read that many more bytes and push them onto the stack as data.
The next byte after that is an op code.  Read it and do what it says.  Repeat until all bytes have been processed.