+/**
+ * Continuation proceeding with initialization after identity subsystem
+ * has been initialized.
+ *
+ * @param args0 filename to publish
+ */
+static void
+identity_continuation (const char *args0)
+{
+ char *ex;
+ char *emsg;
+
+ if ( (NULL != pseudonym) &&
+ (NULL == namespace) )
+ {
+ FPRINTF (stderr,
+ _("Selected pseudonym `%s' unknown\n"),
+ pseudonym);
+ ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (NULL != uri_string)
+ {
+ emsg = NULL;
+ if (NULL == (uri = GNUNET_FS_uri_parse (uri_string, &emsg)))
+ {
+ FPRINTF (stderr,
+ _("Failed to parse URI: %s\n"),
+ emsg);
+ GNUNET_free (emsg);
+ ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ GNUNET_FS_publish_ksk (ctx, topKeywords,
+ meta, uri,
+ &bo,
+ GNUNET_FS_PUBLISH_OPTION_NONE,
+ &uri_ksk_continuation,
+ NULL);
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, "FS", "EXTRACTORS", &ex))
+ ex = NULL;
+ if (0 != ACCESS (args0, R_OK))
+ {
+ FPRINTF (stderr,
+ _("Failed to access `%s': %s\n"),
+ args0,
+ STRERROR (errno));
+ GNUNET_free_non_null (ex);
+ return;
+ }
+ ds = GNUNET_FS_directory_scan_start (args0,
+ disable_extractor,
+ ex,
+ &directory_scan_cb, NULL);
+ if (NULL == ds)
+ {
+ FPRINTF (stderr,
+ "%s",
+ _("Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n"));
+ GNUNET_free_non_null (ex);
+ return;
+ }
+ GNUNET_free_non_null (ex);
+}
+
+
+/**
+ * Function called by identity service with known pseudonyms.
+ *
+ * @param cls closure with 'const char *' of filename to publish
+ * @param ego ego handle
+ * @param ctx context for application to store data for this ego
+ * (during the lifetime of this process, initially NULL)
+ * @param name name assigned by the user for this ego,
+ * NULL if the user just deleted the ego and it
+ * must thus no longer be used
+ */
+static void
+identity_cb (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
+ const char *name)
+{
+ const char *args0 = cls;
+
+ if (NULL == ego)
+ {
+ identity_continuation (args0);
+ return;
+ }
+ if (NULL == name)
+ return;
+ if (0 == strcmp (name, pseudonym))
+ namespace = ego;
+}
+
+