aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/ChangeLog16
-rw-r--r--utils/storecat.c4
-rw-r--r--utils/storeinfo.c22
-rw-r--r--utils/storeread.c8
4 files changed, 38 insertions, 12 deletions
diff --git a/utils/ChangeLog b/utils/ChangeLog
index 2eb8f4eb..5a56b1c9 100644
--- a/utils/ChangeLog
+++ b/utils/ChangeLog
@@ -1,3 +1,19 @@
+2001-01-08 Marcus Brinkmann <marcus@gnu.org>
+
+ * storeread.c (main): Change type of addr to store_offset_t,
+ also for first argument of local function dump.
+ Add comment about store->size as len parameter for store_read.
+ Use atoll instead atoi for addr argument.
+
+ * storeinfo.c (print_store): Remove local function pint, add two
+ similar functions psiz and poff, accepting and printing a size_t
+ or store_offset_t respectively.
+ Use psiz to print block_size, poff to print blocks and size of
+ store.
+ Use %Ld instead %ld to print runs.
+
+ * storecat.c (main): Change type of addr and left to store_offset_t.
+
2000-10-18 Marcus Brinkmann <marcus@gnu.org>
* devprobe.c (main): Call device_close before freeing the device
diff --git a/utils/storecat.c b/utils/storecat.c
index be65b63a..f01c12c1 100644
--- a/utils/storecat.c
+++ b/utils/storecat.c
@@ -30,8 +30,8 @@ main (int argc, char **argv)
error_t err;
struct store *s;
char *name;
- off_t addr;
- size_t left;
+ store_offset_t addr;
+ store_offset_t left;
const struct argp_child kids[] = { { &store_argp }, { 0 }};
struct argp argp =
{ 0, 0, 0, "Write the contents of a store to stdout", kids };
diff --git a/utils/storeinfo.c b/utils/storeinfo.c
index 638cebc7..d088a9fd 100644
--- a/utils/storeinfo.c
+++ b/utils/storeinfo.c
@@ -99,12 +99,20 @@ print_store (struct store *store, int level, unsigned what)
fputs (str ?: "-", stdout);
}
}
- void pint (off_t val, unsigned mask)
+ void psiz (size_t val, unsigned mask)
{
if ((what & mask) == mask)
{
psep ();
- printf ("%ld", val);
+ printf ("%u", val);
+ }
+ }
+ void poff (store_offset_t val, unsigned mask)
+ {
+ if ((what & mask) == mask)
+ {
+ psep ();
+ printf ("%Ld", val);
}
}
@@ -155,9 +163,9 @@ print_store (struct store *store, int level, unsigned what)
}
pstr (store->name, W_NAME);
- pint (store->block_size, W_BLOCK_SIZE);
- pint (store->blocks, W_BLOCKS);
- pint (store->size, W_SIZE);
+ psiz (store->block_size, W_BLOCK_SIZE);
+ poff (store->blocks, W_BLOCKS);
+ poff (store->size, W_SIZE);
if (what & W_RUNS)
{
@@ -168,9 +176,9 @@ print_store (struct store *store, int level, unsigned what)
putchar (',');
if (store->runs[i].start < 0)
/* A hole */
- printf ("@+%ld", store->runs[i].length);
+ printf ("@+%Ld", store->runs[i].length);
else
- printf ("%ld+%ld", store->runs[i].start, store->runs[i].length);
+ printf ("%Ld+%Ld", store->runs[i].start, store->runs[i].length);
}
}
diff --git a/utils/storeread.c b/utils/storeread.c
index 80c36466..52da3fc2 100644
--- a/utils/storeread.c
+++ b/utils/storeread.c
@@ -39,14 +39,16 @@ int
main (int argc, char **argv)
{
struct store *store = 0;
- off_t addr = -1;
+ store_offset_t addr = -1;
int dumped = 0, use_file_io = 0, block_size = 0;
- void dump (off_t addr, ssize_t len)
+ void dump (store_offset_t addr, ssize_t len)
{
char buf[4096];
void *data = buf;
size_t data_len = sizeof (buf);
+
+ /* XXX: store->size can be too big for len. */
error_t err =
store_read (store, addr, len < 0 ? store->size : len,
&data, &data_len);
@@ -92,7 +94,7 @@ main (int argc, char **argv)
error (err, 3, "%s", arg);
}
else if (addr < 0)
- addr = atoi (arg);
+ addr = atoll (arg);
else
{
dump (addr, atoi (arg));