/*
- * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
+ * Copyright (C) 2015-2020 "IoT.bzh"
* Author: José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
/* scan */
n = wsj1_msg_scan(text, items);
- if (n < 0)
+ if (n <= 0)
goto bad_header;
/* scans code: 2|3|4|5 */
- if (items[0][1] != 1) goto bad_header;
+ if (items[0][1] != 1)
+ goto bad_header;
+
switch (text[items[0][0]]) {
case '2': msg->code = CALL; break;
case '3': msg->code = RETOK; break;