QuickDump (QD) is that most boring (and yet quite useful!) of utilities, a binary viewer. It displays the contents of files or stdin in a pleasant to read format. QD also comes with qdlib, which provides QuickDump-like functionality in a C interface, so that you may call QD's capabilities from your programs. This is very useful for (for instance) debugging binary data structures. As of version 4.0, the qd utility is implemented using qdlib, which is how it should have been in the first place. Version 4.1 fixes a couple of bugs and implements "incremental" buffering, to support large files. To build QuickDump, type "make". To install it and the library in the usual places, type "make install". The method used to create qdlib.so is not terribly portable, so if you encounter problems you should probably try "make install-noshared" instead. "make install" will create the files: /usr/local/bin/qd the QuickDump utility /usr/lib/qdlib.a.X.Y the static library /usr/lib/qdlib.so.X.Y the dynamic library QuickDump takes the following command line arguments: qd [-h] [-C] [-n ] [-v] [-w <##>] [] -h turns off emission of name/size header line\ -C use uppercase hexidecimal -n use in name/size header line -v print version information and exit -w display <##> bytes per line (default 8) If is present, it will be interpreted as the name of the file to be opened and displayed. Otherwise, input will be read from stdin. Example outputs (lines shortened a tad to fit in 80 columns): % qd -w 16 /usr/lib/libdps.so | head -5 [/usr/lib/libdps.so] 317248 0 0 : 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 |.ELF............ 16 10 : 03 00 03 00 01 00 00 00 20 df 00 00 34 00 00 00 |........ ...4... 32 20 : 60 d3 03 00 00 00 00 00 34 00 20 00 03 00 28 00 |`.......4. ...(. 48 30 : 1b 00 18 00 01 00 00 00 00 00 00 00 00 00 00 00 |................ % ls | qd -C -w 16 | head -5 [stdin] 124 0 0 : 4D 61 6B 65 66 69 6C 65 0A 52 45 41 44 4D 45 0A |Makefile.README. 16 10 : 65 78 74 61 6E 74 2E 63 0A 65 78 74 61 6E 74 2E |extant.c.extant. 32 20 : 68 0A 65 78 74 61 6E 74 2E 6F 0A 6D 69 73 63 6C |h.extant.o.miscl 48 30 : 69 62 2E 63 0A 6D 69 73 63 6C 69 62 2E 68 0A 6D |ib.c.misclib.h.m The first line of qd's output (which would be suppressed if the -h option were present) is the name of the file being read followed by the total size of the file in bytes. Every line thereafter has two addresses (one in decimal, one in hex) of the first byte displayed on that line, followed by the hexidecimal representation of that line's bytes, followed by the ASCII representation of that line's bytes, with nonprintable characters converted to '.' characters. When the last line would overrun the end of the actual file data, '**' is displayed in the hexidecimal field. The qdlib defines the following symbols for your disposal: extern int qd_major_revision; (4 for qd v4.0) extern int qd_minor_revision; (0 for qd v4.0) (qv also QDLIB_VERSION defined in qdlib.h, which replicates this information.) int qdctl ( int what, int val ); qdctl() allows control over the behaviour of qd() and qd_to_buf(). The following "what" values are defined in qdlib.h: QD_GETWIDTH return the number of bytes per output line, val ignored QD_SETWIDTH set the number of bytes per output line (default 8) QD_GETCASE return the case the hex digits displayed in, val ignored QD_SETCASE set the case of displayed hex digits; 0=lower, 1=upper QD_GETHEAD return whether filename:filesize header will be displayed QD_SETHEAD set 0=suppression or 1=display of filename:filesize header int qd ( char *name, int k, char *buf ); qd() will display "k" bytes from the buffer "buf" to stdout, using "name" in the filename:filesize header. int qd_to_buf ( char *name, int k, char *buf, char *dest, int *max ); qd_to_buf() is like qd(), but instead of writing output to stdout, will write to the given buffer "dest". This is useful for use in debugging functions in conjunction with fprintf(), et al. "max" is a read and write parameter; the caller passes to qd_to_buf() the maximum size of "dest" (to avoid buffer overflows), and qd_to_buf() passes the actual number of bytes used in "dest" back to the caller in "max". Old geeks will recognize the semblence qdlib's output bears to the ANYDISK display of TOPS-20 and CP/M yore. This is no accident. Sometimes the old ways are still the best. Special credit given to Eric Christopher for giving me shit about my use of K&R parameter-passing conventions. I've finally let go and started using this newfangled ANSI-C syntax.