summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-02 18:50:26 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-02 18:50:26 +0100
commit8a0b1d0eff21fc8f0b6007107490d7064af5bacb (patch)
tree7415d398692285106c1bca95f901798334765074 /include
parent027a17b2714c7db6c1824142547afaa0d1ee27e8 (diff)
Support parsing [device] block size argument with SI suffix
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 9938ba0..5f768c1 100644
--- a/include/common.h
+++ b/include/common.h
@@ -159,4 +159,12 @@ void print_version(const char *progname);
*/
sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg);
+/*
+ Parse a number optionally followed by a KMG suffix (case insensitive). Prints
+ an error message to stderr and returns -1 on failure, 0 on success.
+
+ The "what" string is used to prefix error messages (perror style).
+ */
+int parse_size(const char *what, size_t *out, const char *str);
+
#endif /* COMMON_H */