comparison src/editors.c @ 135:15c1925b3bfb

improved external delete command
author nadvornik
date Thu, 16 Aug 2007 20:57:09 +0000
parents 9009856628f7
children 18c2a29e681c
comparison
equal deleted inserted replaced
134:9009856628f7 135:15c1925b3bfb
394 result = g_string_append(result, " 2>&1"); 394 result = g_string_append(result, " 2>&1");
395 ret = editor_verbose_start(vd, result->str); 395 ret = editor_verbose_start(vd, result->str);
396 } 396 }
397 else 397 else
398 { 398 {
399 ret = system(result->str); 399 ret = !system(result->str);
400 } 400 }
401 401
402 if (path_change) chdir(current_path); 402 if (path_change) chdir(current_path);
403 403
404 g_string_free(result, TRUE); 404 g_string_free(result, TRUE);
448 editor_verbose_window_progress(vd, text); 448 editor_verbose_window_progress(vd, text);
449 editor_verbose_window_enable_close(vd); 449 editor_verbose_window_enable_close(vd);
450 return FALSE; 450 return FALSE;
451 } 451 }
452 452
453 static void editor_command_start(const gchar *template, const gchar *text, GList *list) 453 static gint editor_command_start(const gchar *template, const gchar *text, GList *list)
454 { 454 {
455 EditorVerboseData *vd; 455 EditorVerboseData *vd;
456 456
457 vd = editor_verbose_window(template, text); 457 vd = editor_verbose_window(template, text);
458 vd->list = path_list_copy(list); 458 vd->list = path_list_copy(list);
459 vd->total = g_list_length(list); 459 vd->total = g_list_length(list);
460 460
461 editor_command_next(vd); 461 return editor_command_next(vd);
462 } 462 }
463 463
464 static gint editor_line_break(const gchar *template, gchar **front, const gchar **end) 464 static gint editor_line_break(const gchar *template, gchar **front, const gchar **end)
465 { 465 {
466 gchar *found; 466 gchar *found;
542 542
543 work = list; 543 work = list;
544 while (work) 544 while (work)
545 { 545 {
546 gchar *path = work->data; 546 gchar *path = work->data;
547 editor_command_one(template, path, NULL); 547 ret = editor_command_one(template, path, NULL);
548 work = work->next; 548 work = work->next;
549 } 549 }
550 } 550 }
551 } 551 }
552 else 552 else
586 { 586 {
587 EditorVerboseData *vd; 587 EditorVerboseData *vd;
588 588
589 vd = editor_verbose_window(template, text); 589 vd = editor_verbose_window(template, text);
590 editor_verbose_window_progress(vd, _("running...")); 590 editor_verbose_window_progress(vd, _("running..."));
591 editor_verbose_start(vd, result->str); 591 ret = editor_verbose_start(vd, result->str);
592 } 592 }
593 else 593 else
594 { 594 {
595 int status = system(result->str); 595 ret = !system(result->str);
596 /* FIXME: consistent return values */
597 if (!WIFEXITED(status) || WEXITSTATUS(status))
598 ret = FALSE;
599 } 596 }
600 597
601 g_free(front); 598 g_free(front);
602 g_string_free(result, TRUE); 599 g_string_free(result, TRUE);
603 } 600 }