Created
December 3, 2012 05:42
-
-
Save shanna/4192996 to your computer and use it in GitHub Desktop.
libmosquitto mosquitto_topic_matches_sub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <mosquitto.h> | |
int main (int argc, char *argv[]) | |
{ | |
bool matches = false; | |
mosquitto_topic_matches_sub(argv[1], argv[2], &matches); | |
printf("matches: %d\n", matches); | |
return 0; | |
} | |
/* | |
gcc tms.c -o tms -lmosquitto | |
tms "foo/bar" "foo/bar" | |
matches: 1 | |
tms "foo/+" "foo/bar" | |
matches: 0 | |
tms "foo/+/baz "foo/bar/baz" | |
matches: 1 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment