Updated B-SS profile sample build for Zephyr OS. (#711)

This commit is contained in:
Steve Karg
2024-08-06 09:52:10 -05:00
committed by GitHub
parent 61730e3d87
commit a1d91dbeb1
6 changed files with 101 additions and 15 deletions
+25 -1
View File
@@ -7,9 +7,33 @@
*/
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include "bacnet/bacdef.h"
#include "bacnet/indtext.h"
/**
* @brief Compare two strings, case insensitive
* @param a - first string
* @param b - second string
* @return 0 if the strings are equal, non-zero if not
* @note The stricmp() function is not included C standard.
*/
int indtext_stricmp(const char *a, const char *b)
{
int twin_a, twin_b;
do {
twin_a = *(unsigned char *)a;
twin_b = *(unsigned char *)b;
twin_a = tolower(toupper(twin_a));
twin_b = tolower(toupper(twin_b));
a++;
b++;
} while ((twin_a == twin_b) && (twin_a != '\0'));
return twin_a - twin_b;
}
/**
* @brief Search a list of strings to find a matching string
* @param data_list - list of strings and indices
@@ -56,7 +80,7 @@ bool indtext_by_istring(
if (data_list && search_name) {
while (data_list->pString) {
if (strcasecmp(data_list->pString, search_name) == 0) {
if (indtext_stricmp(data_list->pString, search_name) == 0) {
index = data_list->index;
found = true;
break;
+3
View File
@@ -24,6 +24,9 @@ typedef const struct {
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
int indtext_stricmp(const char *a, const char *b);
/* Searches for a matching string and returns the index to the string
in the parameter found_index.
If the string is not found, false is returned