diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2024-04-01 21:52:36 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2024-04-01 21:52:36 +0200 |
commit | a2ea0339e53506562a464f8e17c25359a6fe117a (patch) | |
tree | b0ac0b7dbd0e407aacb5813318f4e0b9f23baa3b /src/pocsag/pocsag.c | |
parent | b8b250bd0aed1e06eb18da911d5f7be1b8049002 (diff) |
pocsag: Allow dialing function digit A..D (numeric, tone 1, tone 2, alpha)
Diffstat (limited to 'src/pocsag/pocsag.c')
-rw-r--r-- | src/pocsag/pocsag.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/pocsag/pocsag.c b/src/pocsag/pocsag.c index a8e6579..39f1045 100644 --- a/src/pocsag/pocsag.c +++ b/src/pocsag/pocsag.c @@ -144,16 +144,19 @@ const char *pocsag_number_valid(const char *number) /* assume that the number has valid length(s) and digits */ - for (i = 0; i < 7; i++) + for (i = 0; i < 7; i++) { + if (number[i] < '0' || number[i] > '9') + return "Illegal RIC digit (Use 0..9 only)"; ric = ric * 10 + number[i] - '0'; + } if (ric > 2097151) - return "Maximum allowed RIC is (2^21)-1. (2097151)"; + return "Maximum allowed RIC is (2^21)-1. (2097151)"; if ((ric & 0xfffffff8) == 2007664) - return "Illegal RIC. (Used for idle codeword)"; + return "Illegal RIC. (Used for idle codeword)"; - if (number[7] && (number[7] < '0' || number[7] > '3')) - return "Illegal function digit #8 (Use 0..3 only)"; + if (number[7] && !(number[7] >= '0' && number[7] <= '3') && !(number[7] >= 'A' && number[7] <= 'D')) + return "Illegal function digit #8 (Use 0..3 only)"; return NULL; } @@ -516,6 +519,10 @@ int call_down_setup(int callref, const char *caller_id, enum number_type __attri ric = ric * 10 + dialing[i] - '0'; if (dialing[7] >= '0' && dialing[7] <= '3') function = dialing[7]- '0'; + else if (dialing[7] >= 'a' && dialing[7] <= 'd') + function = dialing[7]- 'A'; + else if (dialing[7] >= 'A' && dialing[7] <= 'D') + function = dialing[7]- 'A'; else function = pocsag->default_function; |