MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / find_on_list

Function find_on_list

tests/memcsv.c:1036–1063  ·  view source on GitHub ↗

Find a string on the list. Assumes the last element on the list is NULL \param list - a list \param what - a string to find \return string position on the list on success, -1 if string not found or if string is empty */

Source from the content-addressed store, hash-verified

1034 -1 if string not found or if string is empty
1035*/
1036int find_on_list(char **list, const char *what)
1037{
1038 int i = 0;
1039
1040 if (!what)
1041 {
1042 return -1;
1043 }
1044
1045 if (!list[i])
1046 {
1047 return -1;
1048 }
1049
1050 while (list[i] != NULL)
1051 {
1052 if (strcmp(list[i], what) == 0)
1053 {
1054 return i;
1055 }
1056 else
1057 {
1058 i++;
1059 }
1060 }
1061
1062 return i;
1063}

Callers 1

set_channel_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected