michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: michael@0: Converts a binary stream of address references to a text stream, michael@0: hexadecimal, newline separated. michael@0: michael@0: */ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: int michael@0: main(int argc, char *argv[]) michael@0: { michael@0: unsigned int buf[1024]; michael@0: ssize_t cb; michael@0: michael@0: while ((cb = read(STDIN_FILENO, buf, sizeof buf)) > 0) { michael@0: if (cb % sizeof buf[0]) michael@0: fprintf(stderr, "unaligned read\n"); michael@0: michael@0: unsigned int *addr = buf; michael@0: unsigned int *limit = buf + (cb / 4); michael@0: michael@0: for (; addr < limit; ++addr) michael@0: printf("%x\n", *addr); michael@0: } michael@0: michael@0: return 0; michael@0: }