| | |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strncasecmp(str1, str2, len2) == 0) { |
| | | if (SCPI_strncasecmp(str1, str2, len2) == 0) { |
| | | return TRUE; |
| | | } |
| | | |
| | |
| | | STATE_TEXT, |
| | | STATE_LAST_WHITESPACE, |
| | | STATE_COMMA, |
| | | STATE_ERROR, |
| | | STATE_ERROR |
| | | }; |
| | | typedef enum _locate_text_states locate_text_states; |
| | | |
| | |
| | | /** |
| | | * Test locate text state, if it is correct final state |
| | | */ |
| | | static inline bool_t isFinalState(locate_text_states state) { |
| | | static bool_t isFinalState(locate_text_states state) { |
| | | return ( |
| | | ((state) == STATE_COMMA) |
| | | || ((state) == STATE_LAST_WHITESPACE) |
| | |
| | | * @param nfa stores automaton state |
| | | * @param c current char processed |
| | | */ |
| | | static inline bool_t locateTextAutomaton(locate_text_nfa * nfa, unsigned char c) { |
| | | static bool_t locateTextAutomaton(locate_text_nfa * nfa, unsigned char c) { |
| | | switch(nfa->state) { |
| | | /* first state locating only white spaces */ |
| | | case STATE_FIRST_WHITESPACE: |
| | |
| | | * @param nfa stores automaton state |
| | | * @param c current char processed |
| | | */ |
| | | static inline bool_t locateStrAutomaton(locate_text_nfa * nfa, unsigned char c) { |
| | | static bool_t locateStrAutomaton(locate_text_nfa * nfa, unsigned char c) { |
| | | switch(nfa->state) { |
| | | /* first state locating only white spaces */ |
| | | case STATE_FIRST_WHITESPACE: |
| | |
| | | return compareStr(pattern, pattern_len, str, str_len) || |
| | | compareStr(pattern, pattern_sep_pos_short, str, str_len); |
| | | } |
| | | |
| | | |
| | | #if !HAVE_STRNLEN |
| | | /* use FreeBSD strnlen */ |
| | | |
| | | /*- |
| | | * Copyright (c) 2009 David Schultz <das@FreeBSD.org> |
| | | * All rights reserved. |
| | | */ |
| | | size_t |
| | | BSD_strnlen(const char *s, size_t maxlen) |
| | | { |
| | | size_t len; |
| | | |
| | | for (len = 0; len < maxlen; len++, s++) { |
| | | if (!*s) |
| | | break; |
| | | } |
| | | return (len); |
| | | } |
| | | #endif |
| | | |