Example #1
0
int
main(int argc, char **argv)
{
	if (argc < 2 || 1 != (argc % 2)) {
		g_printerr("Usage: %s (NAME TYPE)...\n", argv[0]);
		return 0;
	}

	for (int i=1; i<argc-1 ;i+=2) {
		const gchar *n = argv[i], *t = argv[i+1];
		struct hashstr_s *h = sqliterepo_hash_name(n, t);
		g_print("%s.%s %s.%s\n", n, t, hashstr_str(h), t);
		g_free(h);
	}
	return 0;
}
Example #2
0
static gchar*
get_fullpath(struct zk_manager_s *manager, gchar *subdir, gchar* name)
{
	gchar * result;
	if (subdir)
		result = g_strdup_printf("%s/%s",manager->zk_dir,subdir);
	else
		result =  g_strdup(manager->zk_dir);

	if ( name ) {
		struct sqlx_name_s n = {"", "", ""};
		n.base = name;
		struct hashstr_s *key = sqliterepo_hash_name(&n);
		oio_str_reuse (&result, g_strdup_printf("%s/%s", result, hashstr_str(key)));
		g_free(key);
	}

	return result;
}
Example #3
0
int
main(int argc, char **argv)
{
	if (argc < 2 || 1 != (argc % 2)) {
		g_printerr("Usage: %s (NAME TYPE)...\n", argv[0]);
		return 0;
	}

	for (int i=1; i<argc-1 ;i+=2) {
		struct sqlx_name_s n = {
			.base = argv[i],
			.type = argv[i+1],
			.ns = "",
		};
		struct hashstr_s *h = sqliterepo_hash_name(&n);
		g_print("%s.%s %s.%s\n", n.base, n.type, hashstr_str(h), n.type);
		g_free(h);
	}
	return 0;
}