diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-21 12:15:18 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-21 12:15:18 +0000 |
commit | 23fbfdade60daf4b88cec374ccd4532d8c87324b (patch) | |
tree | 53619a522bf2453e5f44e1d62ba497c3d35d71e1 | |
parent | 0f50ba19f099a7ed3c98f92028ea6f96dfd1aa73 (diff) |
prefix based plugin lookup for peerinfo tool
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo_plugins.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo_plugins.c b/src/peerinfo-tool/gnunet-peerinfo_plugins.c index ba7c1d3925..3bca9feb2c 100644 --- a/src/peerinfo-tool/gnunet-peerinfo_plugins.c +++ b/src/peerinfo-tool/gnunet-peerinfo_plugins.c @@ -167,8 +167,18 @@ GPI_plugins_find (const char *name) { struct TransportPlugin *head = plugins_head; - while ((head != NULL) && (0 != strcmp (name, head->short_name))) + char *stripped = GNUNET_strdup (name); + char *sep = strchr (stripped, '_'); + if (NULL != sep) + sep[0] = '\0'; + + while (head != NULL) + { + if (head->short_name == strstr (head->short_name, stripped)) + break; head = head->next; + } + GNUNET_free (stripped); if (NULL == head) return NULL; return head->api; |