blkid_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
findfs_LDADD = $(ul_libblkid_la)
findfs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
+wipefs_SOURCES = wipefs.c ../lib/strtosize.c
wipefs_LDADD = $(ul_libblkid_la)
wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
if HAVE_STATIC_BLKID
Specifies location (in bytes) of the signature which should be erased from the
device. The offset number may include a "0x" prefix, and then the number will be
read as a hex value. It is possible to specify multiple -o options.
+
+The \fIoffset\fR argument may be followed by binary (2^N) suffixes KiB, MiB,
+GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the same meaning as
+"KiB") or decimal (10^N) suffixes KB, MB, GB, PB and EB.
.IP "\fB\-p, \-\-parsable\fP"
Print out in parsable instead of printable format. Encode all potentially unsafe
characters of a string to the corresponding hex value prefixed by '\\x'.
#include <blkid.h>
#include "nls.h"
+#include "strtosize.h"
struct wipe_desc {
loff_t offset; /* magic string offset */
static loff_t
strtoll_offset(const char *str)
{
- char *end = NULL;
- loff_t off;
+ uintmax_t sz;
- errno = 0;
- off = strtoll(str, &end, 0);
-
- if ((errno == ERANGE && (off == LLONG_MAX || off == LONG_MIN)) ||
- (errno != 0 && off == 0))
- err(EXIT_FAILURE, _("invalid offset '%s' value specified"), str);
-
- if (*end != '\0')
+ if (strtosize(str, &sz))
errx(EXIT_FAILURE, _("invalid offset '%s' value specified"), str);
-
- return off;
+ return sz;
}
+
static void __attribute__((__noreturn__))
usage(FILE *out)
{