On Wed, 01 Jul 2009 00:06:05 +0200 (CEST), Alexander Best <alexbestms@math.uni-muenster.de> wrote:... Note that %x will only print *one* digit for values smaller than 16, i.e. printf("%x", 10) => "a", so it may be useful to use "%02x" instead. For multi-byte fields, it makes sense to print "0x" first and then iterate. For single-byte values, it's probably a tiny bit faster to go only _once_ through for *printf() family formatter, i.e.: - fprintf(stderr, "\nFixed Value: 0x"); - fprintf(stderr, "%x", hdr->fixed_val); + fprintf(stderr, "\nFixed Value: 0x%x", hdr->fixed_val); Another nit that I noticed is that your last line doesn't end with "\n": Some terminal setups will *not* output the last line if it does not finish properly with a "\n", so it may be worth editing the code to avoid the "\nXXX" format idiom, and go for a format style that puts "\n" at the _end_ of output lines: fprintf(stderr, "Nintendo Logo: 0x"); for (i = 0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "%02x", hdr->nintendo_logo[i]); fprintf(stderr, "\n"); fprintf(stderr, "Fixed Value: 0x%02x\n", hdr->fixed_val); _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
| Andrew Morton | -mm merge plans for 2.6.23 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Greg KH | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Tomasz Kłoczko | Is it time for remove (crap) ALSA from kernel tree ? |
git: | |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Paweł Staszewski | iproute2 action/policer question |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
