aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uxd.14
-rw-r--r--uxd.c7
-rw-r--r--uxd.rst4
3 files changed, 12 insertions, 3 deletions
diff --git a/uxd.1 b/uxd.1
index d6868f3..d4c1cc9 100644
--- a/uxd.1
+++ b/uxd.1
@@ -109,7 +109,9 @@ bad sequences.
.BI \-l \ length
Stop dumping after \fIlength\fP bytes (not characters). If the limit is
reached in the middle of a multibyte character, the entire character
-will be dumped.
+will be dumped. Can be given in decimal, hex (with \fI0x\fP prefix), or
+octal (with \fI0\fP prefix). Negative \fIlength\fP doesn\(aqt make sense, and
+is an error.
.UNINDENT
.\" stop dumping after <length> bytes (not characters).
.
diff --git a/uxd.c b/uxd.c
index 95a91bd..6ea3897 100644
--- a/uxd.c
+++ b/uxd.c
@@ -230,7 +230,12 @@ void parse_args(int argc, char **argv) {
case 'b':
bold = 1; break;
case 'l':
- limit = parse_number(opt, optarg); break;
+ limit = parse_number(opt, optarg);
+ if(limit < 0) {
+ fprintf(stderr, "%s: negative limit for -l not allowed.\n", self);
+ exit(1);
+ }
+ break;
case 'r':
hilite_multi = 1; break;
case 'm':
diff --git a/uxd.rst b/uxd.rst
index a17eb1c..a6c90fd 100644
--- a/uxd.rst
+++ b/uxd.rst
@@ -88,7 +88,9 @@ by itself.
-l length
Stop dumping after *length* bytes (not characters). If the limit is
reached in the middle of a multibyte character, the entire character
- will be dumped.
+ will be dumped. Can be given in decimal, hex (with *0x* prefix), or
+ octal (with *0* prefix). Negative *length* doesn't make sense, and
+ is an error.
.. stop dumping after <length> bytes (not characters).