4 * Created on: Feb 14, 2011
16 char *get_as_hex_str(const char *byte_arr, int byte_count) {
22 if ((byte_arr != NULL) &&
24 ret_val = malloc(5 * byte_count);
25 for (ii = 0; ii < byte_count; ii++) {
27 snprintf(ret_val, 5, "0x%02x", byte_arr[ii]);
30 snprintf(item, 5, "0x%02x", byte_arr[ii]);
31 strcat(ret_val, item);
33 if (ii < (byte_count - 1)) {
41 bool parse_long(const char *str, long *result) {
48 new_result = strtol(str, &endptr, 10);
50 log_error("invalid input %s, could not convert to integer.\n", str);
54 log_error("invalid input %s, could not convert to integer.\n", str);