summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-12-06 15:12:36 +0100
committerJose Bollo <jose.bollo@iot.bzh>2019-12-06 15:18:48 +0100
commit23bc1035a51fe54600db691981f8ed1537cbe125 (patch)
tree4e0ec6c9d03072d8313b75632d3448b4ba3a8432 /src
parent6c88efcb7b1361ba6389753e520e26fc556b7d79 (diff)
agent-at: Move field separator from : to ;icefish_8.99.3icefish/8.99.38.99.3
Because Smack labels and permissions of AGL all contain the character colon (:), it is better have a distinct field separator for agent-at. Bug-AGL: SPEC-2968 Change-Id: I378eefcd7b29e424acccced62abe48b35ad8736e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/agent-at.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/agent-at.c b/src/agent-at.c
index 89e78d3..f0731f3 100644
--- a/src/agent-at.c
+++ b/src/agent-at.c
@@ -29,6 +29,9 @@
#include "data.h"
#include "cyn.h"
+static const char separator = ';';
+static const char escape = '%';
+
/**
* Parse the spec to extract the derived key to ask.
*
@@ -58,12 +61,12 @@ parse(
/* compute value of the derived field */
inf = iout;
while(*spec) {
- if (*spec == ':' && ikey < 3) {
+ if (*spec == separator && ikey < 3) {
/* : is the separator of key's items */
spec++;
break; /* next key */
}
- if (!(*spec == '%' && spec[1])) {
+ if (!(*spec == escape && spec[1])) {
/* not a % substitution mark */
if (iout < szbuf)
buffer[iout] = *spec;
@@ -95,10 +98,10 @@ parse(
}
if (!sub) {
/* no substitution */
- if (spec[1] != ':' && spec[1] != '%') {
+ if (spec[1] != separator && spec[1] != escape) {
/* only escape % and : */
if (iout < szbuf)
- buffer[iout] = '%';
+ buffer[iout] = escape;
iout++;
}
if (iout < szbuf)