aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uxd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/uxd.c b/uxd.c
index 1651a2f..59c16e9 100644
--- a/uxd.c
+++ b/uxd.c
@@ -205,9 +205,17 @@ long parse_number(int opt, const char *s) {
result = strtol(s, &e, 0);
- if(*e) {
- fprintf(stderr, "%s: invalid number for -%c option.\n", self, opt);
- exit(1);
+ switch(*e) {
+ case 0: break;
+ case 'k': result *= 1024L; break;
+ case 'm': result *= 1048576L; break;
+ case 'g': result *= 1073741824L; break;
+ case 'K': result *= 1000L; break;
+ case 'M': result *= 1000000L; break;
+ case 'G': result *= 1000000000L; break;
+ default:
+ fprintf(stderr, "%s: invalid number for -%c option.\n", self, opt);
+ exit(1);
}
return result;
@@ -700,7 +708,7 @@ void print_info(void) {
void dump_loop(void) {
while(dump_utf8_char())
- if(limit && (filepos >= limit)) break;
+ if(limit && (byte_count >= limit)) break;
/* handle the last line, if the file size not divisible by 16. */
if(dump_column)