1 /* ----------------------------------------------------------------------- *
3 * Copyright 2010 Gene Cumm
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
16 * Makes an image that contains the LBA in every *word of every sector
25 #define NUM_SECT (256*63+1)
27 #define SECT_INT (BPS / sizeof(unsigned int))
29 typedef unsigned char uint8_t;
30 typedef unsigned int uint32_t;
32 const char DEF_FN
[] = "-";
34 int main(int argc
, char *argv
[])
36 int i
, rv
= 0, one
= 0;
37 unsigned int lba
, b
[SECT_INT
];
45 if (strcasecmp("-1", argv
[1]) == 0) {
64 fprintf(stderr
, "%s: %s: unable to open for writing: %s\n",
65 argv
[0], fn
, strerror(errno
));
70 while ((len
= fread(b
, 1, BPS
, stdin
))) {
72 memset((char *)b
+ len
, 0, BPS
- len
);
77 memset(b
, 0, sizeof b
);
79 while (lba
< NUM_SECT
) {
83 for (i
= 0; i
< SECT_INT
; i
++)