* @param scls must be of type "struct GNUNET_FS_Uri **"
* @param option name of the option (typically 'k')
* @param value command line argument given
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
static int
-getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
- *ctx, void *scls, const char *option,
- const char *value)
+getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
+ void *scls,
+ const char *option,
+ const char *value)
{
struct GNUNET_FS_Uri **uri = scls;
struct GNUNET_FS_Uri *u = *uri;
char *val;
size_t slen;
- if (u == NULL)
+ if (NULL == u)
{
u = GNUNET_new (struct GNUNET_FS_Uri);
*uri = u;
}
else
{
- GNUNET_assert (u->type == GNUNET_FS_URI_KSK);
+ GNUNET_assert (GNUNET_FS_URI_KSK == u->type);
}
slen = strlen (value);
- if (slen == 0)
+ if (0 == slen)
return GNUNET_SYSERR; /* cannot be empty */
if (value[0] == '+')
{
/* remove the quotes, keep the '+' */
val = GNUNET_malloc (slen - 1);
val[0] = '+';
- GNUNET_memcpy (&val[1], &value[2], slen - 3);
+ GNUNET_memcpy (&val[1],
+ &value[2],
+ slen - 3);
val[slen - 2] = '\0';
}
else
/* remove the quotes, add a space */
val = GNUNET_malloc (slen);
val[0] = ' ';
- GNUNET_memcpy (&val[1], &value[1], slen - 2);
+ GNUNET_memcpy (&val[1],
+ &value[1],
+ slen - 2);
val[slen - 1] = '\0';
}
else
strcat (val, value);
}
}
- GNUNET_array_append (u->data.ksk.keywords, u->data.ksk.keywordCount, val);
+ GNUNET_array_append (u->data.ksk.keywords,
+ u->data.ksk.keywordCount,
+ val);
return GNUNET_OK;
}
+
/**
* Allow user to specify keywords.
*
return clo;
}
+
/**
* Command-line option parser function that allows the user to specify
* one or more '-m' options with metadata. Each specified entry of
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_FS_publish_ksk (ctx, topKeywords,
+ GNUNET_FS_publish_ksk (ctx,
+ topKeywords,
meta, uri,
&bo,
GNUNET_FS_PUBLISH_OPTION_NONE,
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *const *argv)
+main (int argc,
+ char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_uint ('a',
"TYPE:VALUE",
gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
&meta),
-
GNUNET_GETOPT_option_flag ('n',
- "noindex",
- gettext_noop ("do not index, perform full insertion (stores "
- "entire file in encrypted form in GNUnet database)"),
- &do_insert),
-
+ "noindex",
+ gettext_noop ("do not index, perform full insertion (stores "
+ "entire file in encrypted form in GNUnet database)"),
+ &do_insert),
GNUNET_GETOPT_option_string ('N',
"next",
"ID",
gettext_noop ("specify ID of an updated version to be "
"published in the future (for namespace insertions only)"),
&next_id),
-
GNUNET_GETOPT_option_uint ('p',
- "priority",
- "PRIORITY",
- gettext_noop ("specify the priority of the content"),
- &bo.content_priority),
-
+ "priority",
+ "PRIORITY",
+ gettext_noop ("specify the priority of the content"),
+ &bo.content_priority),
GNUNET_GETOPT_option_string ('P',
"pseudonym",
"NAME",
gettext_noop ("set the ID of this version of the publication "
"(for namespace insertions only)"),
&this_id),
-
GNUNET_GETOPT_option_string ('u',
"uri",
"URI",
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-publish [OPTIONS] FILENAME",
+ GNUNET_PROGRAM_run (argc,
+ argv,
+ "gnunet-publish [OPTIONS] FILENAME",
gettext_noop
("Publish a file or directory on GNUnet"),
- options, &run, NULL)) ? ret : 1;
+ options,
+ &run,
+ NULL)) ? ret : 1;
GNUNET_free ((void*) argv);
return ret;
}
main (int argc, char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
-
GNUNET_GETOPT_option_uint ('a',
- "anonymity",
- "LEVEL",
- gettext_noop ("set the desired LEVEL of receiver-anonymity"),
- &anonymity),
-
-
+ "anonymity",
+ "LEVEL",
+ gettext_noop ("set the desired LEVEL of receiver-anonymity"),
+ &anonymity),
GNUNET_GETOPT_option_flag ('n',
- "no-network",
- gettext_noop ("only search the local peer (no P2P network search)"),
- &local_only),
-
+ "no-network",
+ gettext_noop ("only search the local peer (no P2P network search)"),
+ &local_only),
GNUNET_GETOPT_option_string ('o',
"output",
"PREFIX",
gettext_noop ("write search results to file starting with PREFIX"),
&output_filename),
-
GNUNET_GETOPT_option_relative_time ('t',
- "timeout",
- "DELAY",
- gettext_noop ("automatically terminate search after DELAY"),
- &timeout),
-
-
+ "timeout",
+ "DELAY",
+ gettext_noop ("automatically terminate search after DELAY"),
+ &timeout),
GNUNET_GETOPT_option_verbose (&verbose),
-
GNUNET_GETOPT_option_uint ('N',
- "results",
- "VALUE",
- gettext_noop ("automatically terminate search "
- "after VALUE results are found"),
- &results_limit),
-
+ "results",
+ "VALUE",
+ gettext_noop ("automatically terminate search "
+ "after VALUE results are found"),
+ &results_limit),
GNUNET_GETOPT_OPTION_END
};
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-search [OPTIONS] KEYWORD",
+ GNUNET_PROGRAM_run (argc,
+ argv,
+ "gnunet-search [OPTIONS] KEYWORD",
gettext_noop
("Search GNUnet for files that were published on GNUnet"),
options, &run, NULL)) ? ret : 1;