1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source3/rpc_server/mdssvc/sparql_parser_test.c
Noel Power 1820209b9e s3/rpc_server/mdssvc: Generate flex/bison files in build
Build the generated files at build time instead of using a committed version
generated at some point in the past.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12528

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Jan 28 13:26:01 CET 2017 on sn-devel-144
2017-01-28 13:26:01 +01:00

39 lines
707 B
C

#include "includes.h"
#include "mdssvc.h"
#include "rpc_server/mdssvc/sparql_parser.tab.h"
/*
* Examples:
*
* $ ./spotlight2sparql '_kMDItemGroupId=="11"'
* ...
* $ ./spotlight2sparql '*=="test*"cwd||kMDItemTextContent=="test*"cwd'
* ...
*/
int main(int argc, char **argv)
{
bool ok;
struct sl_query *slq;
if (argc != 2) {
printf("usage: %s QUERY\n", argv[0]);
return 1;
}
slq = talloc_zero(NULL, struct sl_query);
if (slq == NULL) {
printf("talloc error\n");
return 1;
}
slq->query_string = argv[1];
slq->path_scope = "/foo/bar";
ok = map_spotlight_to_sparql_query(slq);
printf("%s\n", ok ? slq->sparql_query : "*mapping failed*");
talloc_free(slq);
return ok ? 0 : 1;
}