5 * Glue function to return the authoritative part
6 * of a name. i.e. the site of origin
8 * @param name the name to process
9 * @param auth pointer where the result is stored
10 * @return 0 on success < 0 on failure
13 gns_glue_get_auth ( char* name, char* auth )
19 sprintf (cmd, "%s %s", "gnunet-gns -a", name);
25 while (fgets (line, sizeof(line), p) != NULL)
27 if (line[strlen(line)-1] == '\n')
29 line[strlen(line)-1] = '\0';
43 * Glue function to return the short version of
46 * @param name the name to shorten
47 * @param shortened pointer where the result will be stored
48 * @return 0 on success < 0 on failure
51 gns_glue_shorten ( char* name, char* shortened )
57 sprintf (cmd, "%s %s", "gnunet-gns -r -s", name);
63 while (fgets (line, sizeof(line), p) != NULL)
65 if (line[strlen(line)-1] == '\n')
67 line[strlen(line)-1] = '\0';
68 strcpy (shortened, line);
82 * Glue function to expand .+ urls and shorted the
85 * @param to_expand the .+ name to expand
86 * @param host the site of origin
87 * @param shortened the expanded and shortened result pointer
90 gns_glue_expand_and_shorten( char* to_expand, char* host, char* shortened )
98 sprintf (shortened, "%s%s", to_expand, host); //TODO this is a mockup
101 sprintf (cmd, "%s %s", "gnunet-gns -a", host);
107 while (fgets (line, sizeof(line), p) != NULL)
109 if (line[strlen(line)-1] == '\n')
111 line[strlen(line)-1] = '\0';
112 strcpy (sorig, line);
121 sprintf (expanded, "%s.%s", to_expand, sorig);
123 sprintf (cmd, "%s %s", "gnunet-gns -r -s", expanded);
129 while (fgets (line, sizeof(line), p) != NULL)
131 if (line[strlen(line)-1] == '\n')
133 line[strlen(line)-1] = '\0';
134 strcpy (shortened, line);