aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-publish.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-publish.c')
-rw-r--r--src/fs/gnunet-publish.c1076
1 files changed, 547 insertions, 529 deletions
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 84cbf0aac..24baa4d38 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -16,7 +16,7 @@
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file fs/gnunet-publish.c 21 * @file fs/gnunet-publish.c
22 * @brief publishing files on GNUnet 22 * @brief publishing files on GNUnet
@@ -67,7 +67,7 @@ static struct GNUNET_FS_Uri *topKeywords;
67/** 67/**
68 * Options we set for published blocks. 68 * Options we set for published blocks.
69 */ 69 */
70static struct GNUNET_FS_BlockOptions bo = {{0LL}, 1, 365, 1}; 70static struct GNUNET_FS_BlockOptions bo = { { 0LL }, 1, 365, 1 };
71 71
72/** 72/**
73 * Value of URI provided on command-line (when not publishing 73 * Value of URI provided on command-line (when not publishing
@@ -148,41 +148,41 @@ static struct GNUNET_IDENTITY_Handle *identity;
148 * @param cls NULL 148 * @param cls NULL
149 */ 149 */
150static void 150static void
151do_stop_task (void *cls) 151do_stop_task(void *cls)
152{ 152{
153 struct GNUNET_FS_PublishContext *p; 153 struct GNUNET_FS_PublishContext *p;
154 154
155 if (NULL != ds) 155 if (NULL != ds)
156 { 156 {
157 GNUNET_FS_directory_scan_abort (ds); 157 GNUNET_FS_directory_scan_abort(ds);
158 ds = NULL; 158 ds = NULL;
159 } 159 }
160 if (NULL != identity) 160 if (NULL != identity)
161 { 161 {
162 GNUNET_IDENTITY_disconnect (identity); 162 GNUNET_IDENTITY_disconnect(identity);
163 identity = NULL; 163 identity = NULL;
164 } 164 }
165 if (NULL != pc) 165 if (NULL != pc)
166 { 166 {
167 p = pc; 167 p = pc;
168 pc = NULL; 168 pc = NULL;
169 GNUNET_FS_publish_stop (p); 169 GNUNET_FS_publish_stop(p);
170 } 170 }
171 if (NULL != ctx) 171 if (NULL != ctx)
172 { 172 {
173 GNUNET_FS_stop (ctx); 173 GNUNET_FS_stop(ctx);
174 ctx = NULL; 174 ctx = NULL;
175 } 175 }
176 if (NULL != meta) 176 if (NULL != meta)
177 { 177 {
178 GNUNET_CONTAINER_meta_data_destroy (meta); 178 GNUNET_CONTAINER_meta_data_destroy(meta);
179 meta = NULL; 179 meta = NULL;
180 } 180 }
181 if (NULL != uri) 181 if (NULL != uri)
182 { 182 {
183 GNUNET_FS_uri_destroy (uri); 183 GNUNET_FS_uri_destroy(uri);
184 uri = NULL; 184 uri = NULL;
185 } 185 }
186} 186}
187 187
188 188
@@ -200,94 +200,105 @@ do_stop_task (void *cls)
200 * field in the GNUNET_FS_ProgressInfo struct. 200 * field in the GNUNET_FS_ProgressInfo struct.
201 */ 201 */
202static void * 202static void *
203progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) 203progress_cb(void *cls, const struct GNUNET_FS_ProgressInfo *info)
204{ 204{
205 const char *s; 205 const char *s;
206 char *suri; 206 char *suri;
207 207
208 switch (info->status) 208 switch (info->status)
209 {
210 case GNUNET_FS_STATUS_PUBLISH_START:
211 break;
212 case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
213 if (verbose)
214 { 209 {
215 s = GNUNET_STRINGS_relative_time_to_string (info->value.publish.eta, 210 case GNUNET_FS_STATUS_PUBLISH_START:
216 GNUNET_YES); 211 break;
217 fprintf (stdout, 212
218 _ ("Publishing `%s' at %llu/%llu (%s remaining)\n"), 213 case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
219 info->value.publish.filename, 214 if (verbose)
220 (unsigned long long) info->value.publish.completed, 215 {
221 (unsigned long long) info->value.publish.size, 216 s = GNUNET_STRINGS_relative_time_to_string(info->value.publish.eta,
222 s); 217 GNUNET_YES);
223 } 218 fprintf(stdout,
224 break; 219 _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
225 case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY: 220 info->value.publish.filename,
226 if (verbose) 221 (unsigned long long)info->value.publish.completed,
227 { 222 (unsigned long long)info->value.publish.size,
228 s = GNUNET_STRINGS_relative_time_to_string (info->value.publish.specifics 223 s);
229 .progress_directory.eta, 224 }
230 GNUNET_YES); 225 break;
231 fprintf (stdout, 226
232 _ ("Publishing `%s' at %llu/%llu (%s remaining)\n"), 227 case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
233 info->value.publish.filename, 228 if (verbose)
234 (unsigned long long) 229 {
235 info->value.publish.specifics.progress_directory.completed, 230 s = GNUNET_STRINGS_relative_time_to_string(info->value.publish.specifics
236 (unsigned long long) 231 .progress_directory.eta,
237 info->value.publish.specifics.progress_directory.total, 232 GNUNET_YES);
238 s); 233 fprintf(stdout,
239 } 234 _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
240 break; 235 info->value.publish.filename,
241 case GNUNET_FS_STATUS_PUBLISH_ERROR: 236 (unsigned long long)
242 fprintf (stderr, 237 info->value.publish.specifics.progress_directory.completed,
243 _ ("Error publishing: %s.\n"), 238 (unsigned long long)
244 info->value.publish.specifics.error.message); 239 info->value.publish.specifics.progress_directory.total,
245 ret = 1; 240 s);
246 GNUNET_SCHEDULER_shutdown (); 241 }
247 break; 242 break;
248 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: 243
249 fprintf (stdout, 244 case GNUNET_FS_STATUS_PUBLISH_ERROR:
250 _ ("Publishing `%s' done.\n"), 245 fprintf(stderr,
251 info->value.publish.filename); 246 _("Error publishing: %s.\n"),
252 suri = 247 info->value.publish.specifics.error.message);
253 GNUNET_FS_uri_to_string (info->value.publish.specifics.completed.chk_uri); 248 ret = 1;
254 fprintf (stdout, _ ("URI is `%s'.\n"), suri); 249 GNUNET_SCHEDULER_shutdown();
255 GNUNET_free (suri); 250 break;
256 if (NULL != info->value.publish.specifics.completed.sks_uri) 251
257 { 252 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
258 suri = GNUNET_FS_uri_to_string ( 253 fprintf(stdout,
259 info->value.publish.specifics.completed.sks_uri); 254 _("Publishing `%s' done.\n"),
260 fprintf (stdout, _ ("Namespace URI is `%s'.\n"), suri); 255 info->value.publish.filename);
261 GNUNET_free (suri); 256 suri =
262 } 257 GNUNET_FS_uri_to_string(info->value.publish.specifics.completed.chk_uri);
263 if (NULL == info->value.publish.pctx) 258 fprintf(stdout, _("URI is `%s'.\n"), suri);
264 { 259 GNUNET_free(suri);
265 ret = 0; 260 if (NULL != info->value.publish.specifics.completed.sks_uri)
266 GNUNET_SCHEDULER_shutdown (); 261 {
262 suri = GNUNET_FS_uri_to_string(
263 info->value.publish.specifics.completed.sks_uri);
264 fprintf(stdout, _("Namespace URI is `%s'.\n"), suri);
265 GNUNET_free(suri);
266 }
267 if (NULL == info->value.publish.pctx)
268 {
269 ret = 0;
270 GNUNET_SCHEDULER_shutdown();
271 }
272 break;
273
274 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
275 GNUNET_break(NULL == pc);
276 return NULL;
277
278 case GNUNET_FS_STATUS_UNINDEX_START:
279 fprintf(stderr, "%s", _("Starting cleanup after abort\n"));
280 return NULL;
281
282 case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
283 return NULL;
284
285 case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
286 fprintf(stderr, "%s", _("Cleanup after abort completed.\n"));
287 GNUNET_FS_unindex_stop(info->value.unindex.uc);
288 return NULL;
289
290 case GNUNET_FS_STATUS_UNINDEX_ERROR:
291 fprintf(stderr, "%s", _("Cleanup after abort failed.\n"));
292 GNUNET_FS_unindex_stop(info->value.unindex.uc);
293 return NULL;
294
295 case GNUNET_FS_STATUS_UNINDEX_STOPPED:
296 return NULL;
297
298 default:
299 fprintf(stderr, _("Unexpected status: %d\n"), info->status);
300 return NULL;
267 } 301 }
268 break;
269 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
270 GNUNET_break (NULL == pc);
271 return NULL;
272 case GNUNET_FS_STATUS_UNINDEX_START:
273 fprintf (stderr, "%s", _ ("Starting cleanup after abort\n"));
274 return NULL;
275 case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
276 return NULL;
277 case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
278 fprintf (stderr, "%s", _ ("Cleanup after abort completed.\n"));
279 GNUNET_FS_unindex_stop (info->value.unindex.uc);
280 return NULL;
281 case GNUNET_FS_STATUS_UNINDEX_ERROR:
282 fprintf (stderr, "%s", _ ("Cleanup after abort failed.\n"));
283 GNUNET_FS_unindex_stop (info->value.unindex.uc);
284 return NULL;
285 case GNUNET_FS_STATUS_UNINDEX_STOPPED:
286 return NULL;
287 default:
288 fprintf (stderr, _ ("Unexpected status: %d\n"), info->status);
289 return NULL;
290 }
291 return ""; /* non-null */ 302 return ""; /* non-null */
292} 303}
293 304
@@ -306,13 +317,13 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
306 * @return always 0 317 * @return always 0
307 */ 318 */
308static int 319static int
309meta_printer (void *cls, 320meta_printer(void *cls,
310 const char *plugin_name, 321 const char *plugin_name,
311 enum EXTRACTOR_MetaType type, 322 enum EXTRACTOR_MetaType type,
312 enum EXTRACTOR_MetaFormat format, 323 enum EXTRACTOR_MetaFormat format,
313 const char *data_mime_type, 324 const char *data_mime_type,
314 const char *data, 325 const char *data,
315 size_t data_size) 326 size_t data_size)
316{ 327{
317 if ((EXTRACTOR_METAFORMAT_UTF8 != format) && 328 if ((EXTRACTOR_METAFORMAT_UTF8 != format) &&
318 (EXTRACTOR_METAFORMAT_C_STRING != format)) 329 (EXTRACTOR_METAFORMAT_C_STRING != format))
@@ -320,9 +331,9 @@ meta_printer (void *cls,
320 if (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type) 331 if (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type)
321 return 0; 332 return 0;
322#if HAVE_LIBEXTRACTOR 333#if HAVE_LIBEXTRACTOR
323 fprintf (stdout, "\t%s - %s\n", EXTRACTOR_metatype_to_string (type), data); 334 fprintf(stdout, "\t%s - %s\n", EXTRACTOR_metatype_to_string(type), data);
324#else 335#else
325 fprintf (stdout, "\t%d - %s\n", type, data); 336 fprintf(stdout, "\t%d - %s\n", type, data);
326#endif 337#endif
327 return 0; 338 return 0;
328} 339}
@@ -337,9 +348,9 @@ meta_printer (void *cls,
337 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to abort 348 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to abort
338 */ 349 */
339static int 350static int
340keyword_printer (void *cls, const char *keyword, int is_mandatory) 351keyword_printer(void *cls, const char *keyword, int is_mandatory)
341{ 352{
342 fprintf (stdout, "\t%s\n", keyword); 353 fprintf(stdout, "\t%s\n", keyword);
343 return GNUNET_OK; 354 return GNUNET_OK;
344} 355}
345 356
@@ -362,14 +373,14 @@ keyword_printer (void *cls, const char *keyword, int is_mandatory)
362 * to abort the iteration 373 * to abort the iteration
363 */ 374 */
364static int 375static int
365publish_inspector (void *cls, 376publish_inspector(void *cls,
366 struct GNUNET_FS_FileInformation *fi, 377 struct GNUNET_FS_FileInformation *fi,
367 uint64_t length, 378 uint64_t length,
368 struct GNUNET_CONTAINER_MetaData *m, 379 struct GNUNET_CONTAINER_MetaData *m,
369 struct GNUNET_FS_Uri **uri, 380 struct GNUNET_FS_Uri **uri,
370 struct GNUNET_FS_BlockOptions *bo, 381 struct GNUNET_FS_BlockOptions *bo,
371 int *do_index, 382 int *do_index,
372 void **client_info) 383 void **client_info)
373{ 384{
374 char *fn; 385 char *fn;
375 char *fs; 386 char *fs;
@@ -378,50 +389,50 @@ publish_inspector (void *cls,
378 if (cls == fi) 389 if (cls == fi)
379 return GNUNET_OK; 390 return GNUNET_OK;
380 if ((disable_extractor) && (NULL != *uri)) 391 if ((disable_extractor) && (NULL != *uri))
381 {
382 GNUNET_FS_uri_destroy (*uri);
383 *uri = NULL;
384 }
385 if (NULL != topKeywords)
386 {
387 if (NULL != *uri)
388 { 392 {
389 new_uri = GNUNET_FS_uri_ksk_merge (topKeywords, *uri); 393 GNUNET_FS_uri_destroy(*uri);
390 GNUNET_FS_uri_destroy (*uri); 394 *uri = NULL;
391 *uri = new_uri;
392 GNUNET_FS_uri_destroy (topKeywords);
393 } 395 }
394 else 396 if (NULL != topKeywords)
395 { 397 {
396 *uri = topKeywords; 398 if (NULL != *uri)
399 {
400 new_uri = GNUNET_FS_uri_ksk_merge(topKeywords, *uri);
401 GNUNET_FS_uri_destroy(*uri);
402 *uri = new_uri;
403 GNUNET_FS_uri_destroy(topKeywords);
404 }
405 else
406 {
407 *uri = topKeywords;
408 }
409 topKeywords = NULL;
397 } 410 }
398 topKeywords = NULL;
399 }
400 if (NULL != meta) 411 if (NULL != meta)
401 { 412 {
402 GNUNET_CONTAINER_meta_data_merge (m, meta); 413 GNUNET_CONTAINER_meta_data_merge(m, meta);
403 GNUNET_CONTAINER_meta_data_destroy (meta); 414 GNUNET_CONTAINER_meta_data_destroy(meta);
404 meta = NULL; 415 meta = NULL;
405 } 416 }
406 if (enable_creation_time) 417 if (enable_creation_time)
407 GNUNET_CONTAINER_meta_data_add_publication_date (m); 418 GNUNET_CONTAINER_meta_data_add_publication_date(m);
408 if (extract_only) 419 if (extract_only)
409 { 420 {
410 fn = GNUNET_CONTAINER_meta_data_get_by_type ( 421 fn = GNUNET_CONTAINER_meta_data_get_by_type(
411 m, 422 m,
412 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME); 423 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
413 fs = GNUNET_STRINGS_byte_size_fancy (length); 424 fs = GNUNET_STRINGS_byte_size_fancy(length);
414 fprintf (stdout, _ ("Meta data for file `%s' (%s)\n"), fn, fs); 425 fprintf(stdout, _("Meta data for file `%s' (%s)\n"), fn, fs);
415 GNUNET_CONTAINER_meta_data_iterate (m, &meta_printer, NULL); 426 GNUNET_CONTAINER_meta_data_iterate(m, &meta_printer, NULL);
416 fprintf (stdout, _ ("Keywords for file `%s' (%s)\n"), fn, fs); 427 fprintf(stdout, _("Keywords for file `%s' (%s)\n"), fn, fs);
417 GNUNET_free (fn); 428 GNUNET_free(fn);
418 GNUNET_free (fs); 429 GNUNET_free(fs);
419 if (NULL != *uri) 430 if (NULL != *uri)
420 GNUNET_FS_uri_ksk_get_keywords (*uri, &keyword_printer, NULL); 431 GNUNET_FS_uri_ksk_get_keywords(*uri, &keyword_printer, NULL);
421 fprintf (stdout, "%s", "\n"); 432 fprintf(stdout, "%s", "\n");
422 } 433 }
423 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (m)) 434 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory(m))
424 GNUNET_FS_file_information_inspect (fi, &publish_inspector, fi); 435 GNUNET_FS_file_information_inspect(fi, &publish_inspector, fi);
425 return GNUNET_OK; 436 return GNUNET_OK;
426} 437}
427 438
@@ -436,16 +447,16 @@ publish_inspector (void *cls,
436 * @param emsg error message, NULL on success 447 * @param emsg error message, NULL on success
437 */ 448 */
438static void 449static void
439uri_sks_continuation (void *cls, 450uri_sks_continuation(void *cls,
440 const struct GNUNET_FS_Uri *sks_uri, 451 const struct GNUNET_FS_Uri *sks_uri,
441 const char *emsg) 452 const char *emsg)
442{ 453{
443 if (NULL != emsg) 454 if (NULL != emsg)
444 { 455 {
445 fprintf (stderr, "%s\n", emsg); 456 fprintf(stderr, "%s\n", emsg);
446 ret = 1; 457 ret = 1;
447 } 458 }
448 GNUNET_SCHEDULER_shutdown (); 459 GNUNET_SCHEDULER_shutdown();
449} 460}
450 461
451 462
@@ -459,33 +470,33 @@ uri_sks_continuation (void *cls,
459 * @param emsg error message, NULL on success 470 * @param emsg error message, NULL on success
460 */ 471 */
461static void 472static void
462uri_ksk_continuation (void *cls, 473uri_ksk_continuation(void *cls,
463 const struct GNUNET_FS_Uri *ksk_uri, 474 const struct GNUNET_FS_Uri *ksk_uri,
464 const char *emsg) 475 const char *emsg)
465{ 476{
466 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; 477 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
467 478
468 if (NULL != emsg) 479 if (NULL != emsg)
469 { 480 {
470 fprintf (stderr, "%s\n", emsg); 481 fprintf(stderr, "%s\n", emsg);
471 ret = 1; 482 ret = 1;
472 } 483 }
473 if (NULL == namespace) 484 if (NULL == namespace)
474 { 485 {
475 GNUNET_SCHEDULER_shutdown (); 486 GNUNET_SCHEDULER_shutdown();
476 return; 487 return;
477 } 488 }
478 priv = GNUNET_IDENTITY_ego_get_private_key (namespace); 489 priv = GNUNET_IDENTITY_ego_get_private_key(namespace);
479 GNUNET_FS_publish_sks (ctx, 490 GNUNET_FS_publish_sks(ctx,
480 priv, 491 priv,
481 this_id, 492 this_id,
482 next_id, 493 next_id,
483 meta, 494 meta,
484 uri, 495 uri,
485 &bo, 496 &bo,
486 GNUNET_FS_PUBLISH_OPTION_NONE, 497 GNUNET_FS_PUBLISH_OPTION_NONE,
487 &uri_sks_continuation, 498 &uri_sks_continuation,
488 NULL); 499 NULL);
489} 500}
490 501
491 502
@@ -497,52 +508,52 @@ uri_ksk_continuation (void *cls,
497 * @return handle with the information for the publishing operation 508 * @return handle with the information for the publishing operation
498 */ 509 */
499static struct GNUNET_FS_FileInformation * 510static struct GNUNET_FS_FileInformation *
500get_file_information (struct GNUNET_FS_ShareTreeItem *item) 511get_file_information(struct GNUNET_FS_ShareTreeItem *item)
501{ 512{
502 struct GNUNET_FS_FileInformation *fi; 513 struct GNUNET_FS_FileInformation *fi;
503 struct GNUNET_FS_FileInformation *fic; 514 struct GNUNET_FS_FileInformation *fic;
504 struct GNUNET_FS_ShareTreeItem *child; 515 struct GNUNET_FS_ShareTreeItem *child;
505 516
506 if (GNUNET_YES == item->is_directory) 517 if (GNUNET_YES == item->is_directory)
507 {
508 if (NULL == item->meta)
509 item->meta = GNUNET_CONTAINER_meta_data_create ();
510 GNUNET_CONTAINER_meta_data_delete (item->meta,
511 EXTRACTOR_METATYPE_MIMETYPE,
512 NULL,
513 0);
514 GNUNET_FS_meta_data_make_directory (item->meta);
515 if (NULL == item->ksk_uri)
516 { 518 {
517 const char *mime = GNUNET_FS_DIRECTORY_MIME; 519 if (NULL == item->meta)
518 item->ksk_uri = GNUNET_FS_uri_ksk_create_from_args (1, &mime); 520 item->meta = GNUNET_CONTAINER_meta_data_create();
521 GNUNET_CONTAINER_meta_data_delete(item->meta,
522 EXTRACTOR_METATYPE_MIMETYPE,
523 NULL,
524 0);
525 GNUNET_FS_meta_data_make_directory(item->meta);
526 if (NULL == item->ksk_uri)
527 {
528 const char *mime = GNUNET_FS_DIRECTORY_MIME;
529 item->ksk_uri = GNUNET_FS_uri_ksk_create_from_args(1, &mime);
530 }
531 else
532 GNUNET_FS_uri_ksk_add_keyword(item->ksk_uri,
533 GNUNET_FS_DIRECTORY_MIME,
534 GNUNET_NO);
535 fi = GNUNET_FS_file_information_create_empty_directory(ctx,
536 NULL,
537 item->ksk_uri,
538 item->meta,
539 &bo,
540 item->filename);
541 for (child = item->children_head; child; child = child->next)
542 {
543 fic = get_file_information(child);
544 GNUNET_break(GNUNET_OK == GNUNET_FS_file_information_add(fi, fic));
545 }
519 } 546 }
520 else 547 else
521 GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri,
522 GNUNET_FS_DIRECTORY_MIME,
523 GNUNET_NO);
524 fi = GNUNET_FS_file_information_create_empty_directory (ctx,
525 NULL,
526 item->ksk_uri,
527 item->meta,
528 &bo,
529 item->filename);
530 for (child = item->children_head; child; child = child->next)
531 { 548 {
532 fic = get_file_information (child); 549 fi = GNUNET_FS_file_information_create_from_file(ctx,
533 GNUNET_break (GNUNET_OK == GNUNET_FS_file_information_add (fi, fic)); 550 NULL,
551 item->filename,
552 item->ksk_uri,
553 item->meta,
554 !do_insert,
555 &bo);
534 } 556 }
535 }
536 else
537 {
538 fi = GNUNET_FS_file_information_create_from_file (ctx,
539 NULL,
540 item->filename,
541 item->ksk_uri,
542 item->meta,
543 ! do_insert,
544 &bo);
545 }
546 return fi; 557 return fi;
547} 558}
548 559
@@ -554,46 +565,46 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
554 * @param directory_scan_result result from the directory scan, freed in this function 565 * @param directory_scan_result result from the directory scan, freed in this function
555 */ 566 */
556static void 567static void
557directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) 568directory_trim_complete(struct GNUNET_FS_ShareTreeItem *directory_scan_result)
558{ 569{
559 struct GNUNET_FS_FileInformation *fi; 570 struct GNUNET_FS_FileInformation *fi;
560 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; 571 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv;
561 572
562 fi = get_file_information (directory_scan_result); 573 fi = get_file_information(directory_scan_result);
563 GNUNET_FS_share_tree_free (directory_scan_result); 574 GNUNET_FS_share_tree_free(directory_scan_result);
564 if (NULL == fi) 575 if (NULL == fi)
565 { 576 {
566 fprintf (stderr, "%s", _ ("Could not publish\n")); 577 fprintf(stderr, "%s", _("Could not publish\n"));
567 ret = 1; 578 ret = 1;
568 GNUNET_SCHEDULER_shutdown (); 579 GNUNET_SCHEDULER_shutdown();
569 return; 580 return;
570 } 581 }
571 GNUNET_FS_file_information_inspect (fi, &publish_inspector, NULL); 582 GNUNET_FS_file_information_inspect(fi, &publish_inspector, NULL);
572 if (extract_only) 583 if (extract_only)
573 { 584 {
574 GNUNET_FS_file_information_destroy (fi, NULL, NULL); 585 GNUNET_FS_file_information_destroy(fi, NULL, NULL);
575 GNUNET_SCHEDULER_shutdown (); 586 GNUNET_SCHEDULER_shutdown();
576 return; 587 return;
577 } 588 }
578 if (NULL == namespace) 589 if (NULL == namespace)
579 priv = NULL; 590 priv = NULL;
580 else 591 else
581 priv = GNUNET_IDENTITY_ego_get_private_key (namespace); 592 priv = GNUNET_IDENTITY_ego_get_private_key(namespace);
582 pc = GNUNET_FS_publish_start (ctx, 593 pc = GNUNET_FS_publish_start(ctx,
583 fi, 594 fi,
584 priv, 595 priv,
585 this_id, 596 this_id,
586 next_id, 597 next_id,
587 (do_simulate) 598 (do_simulate)
588 ? GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY 599 ? GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY
589 : GNUNET_FS_PUBLISH_OPTION_NONE); 600 : GNUNET_FS_PUBLISH_OPTION_NONE);
590 if (NULL == pc) 601 if (NULL == pc)
591 { 602 {
592 fprintf (stderr, "%s", _ ("Could not start publishing.\n")); 603 fprintf(stderr, "%s", _("Could not start publishing.\n"));
593 ret = 1; 604 ret = 1;
594 GNUNET_SCHEDULER_shutdown (); 605 GNUNET_SCHEDULER_shutdown();
595 return; 606 return;
596 } 607 }
597} 608}
598 609
599 610
@@ -609,57 +620,63 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result)
609 * @param reason kind of progress we are making 620 * @param reason kind of progress we are making
610 */ 621 */
611static void 622static void
612directory_scan_cb (void *cls, 623directory_scan_cb(void *cls,
613 const char *filename, 624 const char *filename,
614 int is_directory, 625 int is_directory,
615 enum GNUNET_FS_DirScannerProgressUpdateReason reason) 626 enum GNUNET_FS_DirScannerProgressUpdateReason reason)
616{ 627{
617 struct GNUNET_FS_ShareTreeItem *directory_scan_result; 628 struct GNUNET_FS_ShareTreeItem *directory_scan_result;
618 629
619 switch (reason) 630 switch (reason)
620 {
621 case GNUNET_FS_DIRSCANNER_FILE_START:
622 if (verbose > 1)
623 { 631 {
624 if (is_directory == GNUNET_YES) 632 case GNUNET_FS_DIRSCANNER_FILE_START:
625 fprintf (stdout, _ ("Scanning directory `%s'.\n"), filename); 633 if (verbose > 1)
626 else 634 {
627 fprintf (stdout, _ ("Scanning file `%s'.\n"), filename); 635 if (is_directory == GNUNET_YES)
636 fprintf(stdout, _("Scanning directory `%s'.\n"), filename);
637 else
638 fprintf(stdout, _("Scanning file `%s'.\n"), filename);
639 }
640 break;
641
642 case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
643 fprintf(stderr,
644 _("There was trouble processing file `%s', skipping it.\n"),
645 filename);
646 break;
647
648 case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
649 if (verbose)
650 fprintf(stdout, "%s", _("Preprocessing complete.\n"));
651 break;
652
653 case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
654 if (verbose > 2)
655 fprintf(stdout,
656 _("Extracting meta data from file `%s' complete.\n"),
657 filename);
658 break;
659
660 case GNUNET_FS_DIRSCANNER_FINISHED:
661 if (verbose > 1)
662 fprintf(stdout, "%s", _("Meta data extraction has finished.\n"));
663 directory_scan_result = GNUNET_FS_directory_scan_get_result(ds);
664 ds = NULL;
665 GNUNET_FS_share_tree_trim(directory_scan_result);
666 directory_trim_complete(directory_scan_result);
667 break;
668
669 case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
670 fprintf(stdout, "%s", _("Error scanning directory.\n"));
671 ret = 1;
672 GNUNET_SCHEDULER_shutdown();
673 break;
674
675 default:
676 GNUNET_assert(0);
677 break;
628 } 678 }
629 break; 679 fflush(stdout);
630 case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
631 fprintf (stderr,
632 _ ("There was trouble processing file `%s', skipping it.\n"),
633 filename);
634 break;
635 case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
636 if (verbose)
637 fprintf (stdout, "%s", _ ("Preprocessing complete.\n"));
638 break;
639 case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
640 if (verbose > 2)
641 fprintf (stdout,
642 _ ("Extracting meta data from file `%s' complete.\n"),
643 filename);
644 break;
645 case GNUNET_FS_DIRSCANNER_FINISHED:
646 if (verbose > 1)
647 fprintf (stdout, "%s", _ ("Meta data extraction has finished.\n"));
648 directory_scan_result = GNUNET_FS_directory_scan_get_result (ds);
649 ds = NULL;
650 GNUNET_FS_share_tree_trim (directory_scan_result);
651 directory_trim_complete (directory_scan_result);
652 break;
653 case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
654 fprintf (stdout, "%s", _ ("Error scanning directory.\n"));
655 ret = 1;
656 GNUNET_SCHEDULER_shutdown ();
657 break;
658 default:
659 GNUNET_assert (0);
660 break;
661 }
662 fflush (stdout);
663} 680}
664 681
665 682
@@ -670,67 +687,67 @@ directory_scan_cb (void *cls,
670 * @param args0 filename to publish 687 * @param args0 filename to publish
671 */ 688 */
672static void 689static void
673identity_continuation (const char *args0) 690identity_continuation(const char *args0)
674{ 691{
675 char *ex; 692 char *ex;
676 char *emsg; 693 char *emsg;
677 694
678 if ((NULL != pseudonym) && (NULL == namespace)) 695 if ((NULL != pseudonym) && (NULL == namespace))
679 {
680 fprintf (stderr, _ ("Selected pseudonym `%s' unknown\n"), pseudonym);
681 ret = 1;
682 GNUNET_SCHEDULER_shutdown ();
683 return;
684 }
685 if (NULL != uri_string)
686 {
687 emsg = NULL;
688 if (NULL == (uri = GNUNET_FS_uri_parse (uri_string, &emsg)))
689 { 696 {
690 fprintf (stderr, _ ("Failed to parse URI: %s\n"), emsg); 697 fprintf(stderr, _("Selected pseudonym `%s' unknown\n"), pseudonym);
691 GNUNET_free (emsg);
692 ret = 1; 698 ret = 1;
693 GNUNET_SCHEDULER_shutdown (); 699 GNUNET_SCHEDULER_shutdown();
700 return;
701 }
702 if (NULL != uri_string)
703 {
704 emsg = NULL;
705 if (NULL == (uri = GNUNET_FS_uri_parse(uri_string, &emsg)))
706 {
707 fprintf(stderr, _("Failed to parse URI: %s\n"), emsg);
708 GNUNET_free(emsg);
709 ret = 1;
710 GNUNET_SCHEDULER_shutdown();
711 return;
712 }
713 GNUNET_FS_publish_ksk(ctx,
714 topKeywords,
715 meta,
716 uri,
717 &bo,
718 GNUNET_FS_PUBLISH_OPTION_NONE,
719 &uri_ksk_continuation,
720 NULL);
694 return; 721 return;
695 } 722 }
696 GNUNET_FS_publish_ksk (ctx,
697 topKeywords,
698 meta,
699 uri,
700 &bo,
701 GNUNET_FS_PUBLISH_OPTION_NONE,
702 &uri_ksk_continuation,
703 NULL);
704 return;
705 }
706 if (GNUNET_OK != 723 if (GNUNET_OK !=
707 GNUNET_CONFIGURATION_get_value_string (cfg, "FS", "EXTRACTORS", &ex)) 724 GNUNET_CONFIGURATION_get_value_string(cfg, "FS", "EXTRACTORS", &ex))
708 ex = NULL; 725 ex = NULL;
709 if (0 != access (args0, R_OK)) 726 if (0 != access(args0, R_OK))
710 { 727 {
711 fprintf (stderr, 728 fprintf(stderr,
712 _ ("Failed to access `%s': %s\n"), 729 _("Failed to access `%s': %s\n"),
713 args0, 730 args0,
714 strerror (errno)); 731 strerror(errno));
715 GNUNET_free_non_null (ex); 732 GNUNET_free_non_null(ex);
716 return; 733 return;
717 } 734 }
718 ds = GNUNET_FS_directory_scan_start (args0, 735 ds = GNUNET_FS_directory_scan_start(args0,
719 disable_extractor, 736 disable_extractor,
720 ex, 737 ex,
721 &directory_scan_cb, 738 &directory_scan_cb,
722 NULL); 739 NULL);
723 if (NULL == ds) 740 if (NULL == ds)
724 { 741 {
725 fprintf ( 742 fprintf(
726 stderr, 743 stderr,
727 "%s", 744 "%s",
728 _ ( 745 _(
729 "Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n")); 746 "Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n"));
730 GNUNET_free_non_null (ex); 747 GNUNET_free_non_null(ex);
731 return; 748 return;
732 } 749 }
733 GNUNET_free_non_null (ex); 750 GNUNET_free_non_null(ex);
734} 751}
735 752
736 753
@@ -746,22 +763,22 @@ identity_continuation (const char *args0)
746 * must thus no longer be used 763 * must thus no longer be used
747 */ 764 */
748static void 765static void
749identity_cb (void *cls, 766identity_cb(void *cls,
750 struct GNUNET_IDENTITY_Ego *ego, 767 struct GNUNET_IDENTITY_Ego *ego,
751 void **ctx, 768 void **ctx,
752 const char *name) 769 const char *name)
753{ 770{
754 const char *args0 = cls; 771 const char *args0 = cls;
755 772
756 if (NULL == ego) 773 if (NULL == ego)
757 { 774 {
758 identity_continuation (args0); 775 identity_continuation(args0);
759 return; 776 return;
760 } 777 }
761 if (NULL == name) 778 if (NULL == name)
762 return; 779 return;
763 if (0 == strcmp (name, pseudonym)) 780 if (0 == strcmp(name, pseudonym))
764 namespace = ego; 781 namespace = ego;
765} 782}
766 783
767 784
@@ -774,82 +791,82 @@ identity_cb (void *cls,
774 * @param c configuration 791 * @param c configuration
775 */ 792 */
776static void 793static void
777run (void *cls, 794run(void *cls,
778 char *const *args, 795 char *const *args,
779 const char *cfgfile, 796 const char *cfgfile,
780 const struct GNUNET_CONFIGURATION_Handle *c) 797 const struct GNUNET_CONFIGURATION_Handle *c)
781{ 798{
782 /* check arguments */ 799 /* check arguments */
783 if ((NULL != uri_string) && (extract_only)) 800 if ((NULL != uri_string) && (extract_only))
784 {
785 printf (_ ("Cannot extract metadata from a URI!\n"));
786 ret = -1;
787 return;
788 }
789 if (((NULL == uri_string) || (extract_only)) &&
790 ((NULL == args[0]) || (NULL != args[1])))
791 {
792 printf (_ ("You must specify one and only one filename for insertion.\n"));
793 ret = -1;
794 return;
795 }
796 if ((NULL != uri_string) && (NULL != args[0]))
797 {
798 printf (_ ("You must NOT specify an URI and a filename.\n"));
799 ret = -1;
800 return;
801 }
802 if (NULL != pseudonym)
803 {
804 if (NULL == this_id)
805 { 801 {
806 fprintf (stderr, 802 printf(_("Cannot extract metadata from a URI!\n"));
807 _ ("Option `%s' is required when using option `%s'.\n"),
808 "-t",
809 "-P");
810 ret = -1; 803 ret = -1;
811 return; 804 return;
812 } 805 }
813 } 806 if (((NULL == uri_string) || (extract_only)) &&
814 else 807 ((NULL == args[0]) || (NULL != args[1])))
815 { /* ordinary insertion checks */
816 if (NULL != next_id)
817 { 808 {
818 fprintf (stderr, 809 printf(_("You must specify one and only one filename for insertion.\n"));
819 _ ("Option `%s' makes no sense without option `%s'.\n"),
820 "-N",
821 "-P");
822 ret = -1; 810 ret = -1;
823 return; 811 return;
824 } 812 }
825 if (NULL != this_id) 813 if ((NULL != uri_string) && (NULL != args[0]))
826 { 814 {
827 fprintf (stderr, 815 printf(_("You must NOT specify an URI and a filename.\n"));
828 _ ("Option `%s' makes no sense without option `%s'.\n"),
829 "-t",
830 "-P");
831 ret = -1; 816 ret = -1;
832 return; 817 return;
833 } 818 }
834 } 819 if (NULL != pseudonym)
820 {
821 if (NULL == this_id)
822 {
823 fprintf(stderr,
824 _("Option `%s' is required when using option `%s'.\n"),
825 "-t",
826 "-P");
827 ret = -1;
828 return;
829 }
830 }
831 else
832 { /* ordinary insertion checks */
833 if (NULL != next_id)
834 {
835 fprintf(stderr,
836 _("Option `%s' makes no sense without option `%s'.\n"),
837 "-N",
838 "-P");
839 ret = -1;
840 return;
841 }
842 if (NULL != this_id)
843 {
844 fprintf(stderr,
845 _("Option `%s' makes no sense without option `%s'.\n"),
846 "-t",
847 "-P");
848 ret = -1;
849 return;
850 }
851 }
835 cfg = c; 852 cfg = c;
836 ctx = GNUNET_FS_start (cfg, 853 ctx = GNUNET_FS_start(cfg,
837 "gnunet-publish", 854 "gnunet-publish",
838 &progress_cb, 855 &progress_cb,
839 NULL, 856 NULL,
840 GNUNET_FS_FLAGS_NONE, 857 GNUNET_FS_FLAGS_NONE,
841 GNUNET_FS_OPTIONS_END); 858 GNUNET_FS_OPTIONS_END);
842 if (NULL == ctx) 859 if (NULL == ctx)
843 { 860 {
844 fprintf (stderr, _ ("Could not initialize `%s' subsystem.\n"), "FS"); 861 fprintf(stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
845 ret = 1; 862 ret = 1;
846 return; 863 return;
847 } 864 }
848 GNUNET_SCHEDULER_add_shutdown (&do_stop_task, NULL); 865 GNUNET_SCHEDULER_add_shutdown(&do_stop_task, NULL);
849 if (NULL != pseudonym) 866 if (NULL != pseudonym)
850 identity = GNUNET_IDENTITY_connect (cfg, &identity_cb, args[0]); 867 identity = GNUNET_IDENTITY_connect(cfg, &identity_cb, args[0]);
851 else 868 else
852 identity_continuation (args[0]); 869 identity_continuation(args[0]);
853} 870}
854 871
855 872
@@ -861,120 +878,121 @@ run (void *cls,
861 * @return 0 ok, 1 on error 878 * @return 0 ok, 1 on error
862 */ 879 */
863int 880int
864main (int argc, char *const *argv) 881main(int argc, char *const *argv)
865{ 882{
866 struct GNUNET_GETOPT_CommandLineOption options[] = 883 struct GNUNET_GETOPT_CommandLineOption options[] =
867 {GNUNET_GETOPT_option_uint ('a', 884 { GNUNET_GETOPT_option_uint('a',
868 "anonymity", 885 "anonymity",
869 "LEVEL", 886 "LEVEL",
870 gettext_noop ( 887 gettext_noop(
871 "set the desired LEVEL of sender-anonymity"), 888 "set the desired LEVEL of sender-anonymity"),
872 &bo.anonymity_level), 889 &bo.anonymity_level),
873 GNUNET_GETOPT_option_flag ( 890 GNUNET_GETOPT_option_flag(
874 'D', 891 'D',
875 "disable-extractor", 892 "disable-extractor",
876 gettext_noop ("do not use libextractor to add keywords or metadata"), 893 gettext_noop("do not use libextractor to add keywords or metadata"),
877 &disable_extractor), 894 &disable_extractor),
878 GNUNET_GETOPT_option_flag ('E', 895 GNUNET_GETOPT_option_flag('E',
879 "enable-creation-time", 896 "enable-creation-time",
880 gettext_noop ( 897 gettext_noop(
881 "enable adding the creation time to the " 898 "enable adding the creation time to the "
882 "metadata of the uploaded file"), 899 "metadata of the uploaded file"),
883 &enable_creation_time), 900 &enable_creation_time),
884 GNUNET_GETOPT_option_flag ('e', 901 GNUNET_GETOPT_option_flag('e',
885 "extract", 902 "extract",
886 gettext_noop ( 903 gettext_noop(
887 "print list of extracted keywords that would " 904 "print list of extracted keywords that would "
888 "be used, but do not perform upload"), 905 "be used, but do not perform upload"),
889 &extract_only), 906 &extract_only),
890 GNUNET_FS_GETOPT_KEYWORDS ( 907 GNUNET_FS_GETOPT_KEYWORDS(
891 'k', 908 'k',
892 "key", 909 "key",
893 "KEYWORD", 910 "KEYWORD",
894 gettext_noop ( 911 gettext_noop(
895 "add an additional keyword for the top-level " 912 "add an additional keyword for the top-level "
896 "file or directory (this option can be specified multiple times)"), 913 "file or directory (this option can be specified multiple times)"),
897 &topKeywords), 914 &topKeywords),
898 GNUNET_FS_GETOPT_METADATA ( 915 GNUNET_FS_GETOPT_METADATA(
899 'm', 916 'm',
900 "meta", 917 "meta",
901 "TYPE:VALUE", 918 "TYPE:VALUE",
902 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), 919 gettext_noop("set the meta-data for the given TYPE to the given VALUE"),
903 &meta), 920 &meta),
904 GNUNET_GETOPT_option_flag ( 921 GNUNET_GETOPT_option_flag(
905 'n', 922 'n',
906 "noindex", 923 "noindex",
907 gettext_noop ("do not index, perform full insertion (stores " 924 gettext_noop("do not index, perform full insertion (stores "
908 "entire file in encrypted form in GNUnet database)"), 925 "entire file in encrypted form in GNUnet database)"),
909 &do_insert), 926 &do_insert),
910 GNUNET_GETOPT_option_string ( 927 GNUNET_GETOPT_option_string(
911 'N', 928 'N',
912 "next", 929 "next",
913 "ID", 930 "ID",
914 gettext_noop ("specify ID of an updated version to be " 931 gettext_noop("specify ID of an updated version to be "
915 "published in the future (for namespace insertions only)"), 932 "published in the future (for namespace insertions only)"),
916 &next_id), 933 &next_id),
917 GNUNET_GETOPT_option_uint ('p', 934 GNUNET_GETOPT_option_uint('p',
918 "priority", 935 "priority",
919 "PRIORITY", 936 "PRIORITY",
920 gettext_noop ( 937 gettext_noop(
921 "specify the priority of the content"), 938 "specify the priority of the content"),
922 &bo.content_priority), 939 &bo.content_priority),
923 GNUNET_GETOPT_option_string ('P', 940 GNUNET_GETOPT_option_string('P',
924 "pseudonym", 941 "pseudonym",
925 "NAME", 942 "NAME",
926 gettext_noop ( 943 gettext_noop(
927 "publish the files under the pseudonym " 944 "publish the files under the pseudonym "
928 "NAME (place file into namespace)"), 945 "NAME (place file into namespace)"),
929 &pseudonym), 946 &pseudonym),
930 GNUNET_GETOPT_option_uint ('r', 947 GNUNET_GETOPT_option_uint('r',
931 "replication", 948 "replication",
932 "LEVEL", 949 "LEVEL",
933 gettext_noop ( 950 gettext_noop(
934 "set the desired replication LEVEL"), 951 "set the desired replication LEVEL"),
935 &bo.replication_level), 952 &bo.replication_level),
936 GNUNET_GETOPT_option_flag ('s', 953 GNUNET_GETOPT_option_flag('s',
937 "simulate-only", 954 "simulate-only",
938 gettext_noop ( 955 gettext_noop(
939 "only simulate the process but do not do " 956 "only simulate the process but do not do "
940 "any actual publishing (useful to compute URIs)"), 957 "any actual publishing (useful to compute URIs)"),
941 &do_simulate), 958 &do_simulate),
942 GNUNET_GETOPT_option_string ('t', 959 GNUNET_GETOPT_option_string('t',
943 "this", 960 "this",
944 "ID", 961 "ID",
945 gettext_noop ( 962 gettext_noop(
946 "set the ID of this version of the publication " 963 "set the ID of this version of the publication "
947 "(for namespace insertions only)"), 964 "(for namespace insertions only)"),
948 &this_id), 965 &this_id),
949 GNUNET_GETOPT_option_string ( 966 GNUNET_GETOPT_option_string(
950 'u', 967 'u',
951 "uri", 968 "uri",
952 "URI", 969 "URI",
953 gettext_noop ( 970 gettext_noop(
954 "URI to be published (can be used instead of passing a " 971 "URI to be published (can be used instead of passing a "
955 "file to add keywords to the file with the respective URI)"), 972 "file to add keywords to the file with the respective URI)"),
956 &uri_string), 973 &uri_string),
957 974
958 GNUNET_GETOPT_option_verbose (&verbose), 975 GNUNET_GETOPT_option_verbose(&verbose),
959 976
960 GNUNET_GETOPT_OPTION_END}; 977 GNUNET_GETOPT_OPTION_END };
978
961 bo.expiration_time = 979 bo.expiration_time =
962 GNUNET_TIME_year_to_time (GNUNET_TIME_get_current_year () + 2); 980 GNUNET_TIME_year_to_time(GNUNET_TIME_get_current_year() + 2);
963 981
964 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 982 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
965 return 2; 983 return 2;
966 ret = 984 ret =
967 (GNUNET_OK == 985 (GNUNET_OK ==
968 GNUNET_PROGRAM_run (argc, 986 GNUNET_PROGRAM_run(argc,
969 argv, 987 argv,
970 "gnunet-publish [OPTIONS] FILENAME", 988 "gnunet-publish [OPTIONS] FILENAME",
971 gettext_noop ("Publish a file or directory on GNUnet"), 989 gettext_noop("Publish a file or directory on GNUnet"),
972 options, 990 options,
973 &run, 991 &run,
974 NULL)) 992 NULL))
975 ? ret 993 ? ret
976 : 1; 994 : 1;
977 GNUNET_free ((void *) argv); 995 GNUNET_free((void *)argv);
978 return ret; 996 return ret;
979} 997}
980 998