diff options
author | 2015-08-12 09:39:43 +0000 | |
---|---|---|
committer | 2015-08-12 09:39:43 +0000 | |
commit | e3896e14dde823d36960cf4731f25f82ae9162db (patch) | |
tree | dae12d2590cff77acbe903d4d3753175344e7f2b | |
parent | Mention LC_MESSAGES. (diff) | |
download | wireguard-openbsd-e3896e14dde823d36960cf4731f25f82ae9162db.tar.xz wireguard-openbsd-e3896e14dde823d36960cf4731f25f82ae9162db.zip |
Support + and - for dates.
-rw-r--r-- | usr.bin/file/magic-test.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/file/magic-test.c b/usr.bin/file/magic-test.c index 26d9592ada4..f2c72ea90a5 100644 --- a/usr.bin/file/magic-test.c +++ b/usr.bin/file/magic-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-test.c,v 1.12 2015/08/12 09:29:49 nicm Exp $ */ +/* $OpenBSD: magic-test.c,v 1.13 2015/08/12 09:39:43 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -702,6 +702,10 @@ magic_test_type_date(struct magic_line *ml, struct magic_state *ms) if (ml->type_operator == '&') value &= (int32_t)ml->type_operand; + else if (ml->type_operator == '-') + value -= (int32_t)ml->type_operand; + else if (ml->type_operator == '+') + value += (int32_t)ml->type_operand; else if (ml->type_operator != ' ') return (-1); @@ -744,6 +748,10 @@ magic_test_type_qdate(struct magic_line *ml, struct magic_state *ms) if (ml->type_operator == '&') value &= (int64_t)ml->type_operand; + else if (ml->type_operator == '-') + value -= (int64_t)ml->type_operand; + else if (ml->type_operator == '+') + value += (int64_t)ml->type_operand; else if (ml->type_operator != ' ') return (-1); @@ -786,6 +794,10 @@ magic_test_type_udate(struct magic_line *ml, struct magic_state *ms) if (ml->type_operator == '&') value &= (uint32_t)ml->type_operand; + else if (ml->type_operator == '-') + value -= (uint32_t)ml->type_operand; + else if (ml->type_operator == '+') + value += (uint32_t)ml->type_operand; else if (ml->type_operator != ' ') return (-1); @@ -828,6 +840,10 @@ magic_test_type_uqdate(struct magic_line *ml, struct magic_state *ms) if (ml->type_operator == '&') value &= (uint64_t)ml->type_operand; + else if (ml->type_operator == '-') + value -= (uint64_t)ml->type_operand; + else if (ml->type_operator == '+') + value += (uint64_t)ml->type_operand; else if (ml->type_operator != ' ') return (-1); |