From b31f2ad72010e397fa7514b4d61f2adf716f1038 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 25 Feb 2013 15:03:11 -0500 Subject: evolution-addressbook-export: Remove --async option. Pointless option, does the same as "evolution-addressbook-export &". --- .../evolution-addressbook-export-list-cards.c | 107 +++------------------ 1 file changed, 14 insertions(+), 93 deletions(-) (limited to 'addressbook/tools/evolution-addressbook-export-list-cards.c') diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c index eee2fe92b7..89fd75834f 100644 --- a/addressbook/tools/evolution-addressbook-export-list-cards.c +++ b/addressbook/tools/evolution-addressbook-export-list-cards.c @@ -244,7 +244,6 @@ gchar *delivery_address_get_sub_field (const EContactAddress * delivery_address, gchar *check_null_pointer (gchar * orig); gchar *escape_string (gchar * orig); gint output_n_cards_file (FILE * outputfile, GSList *contacts, gint size, gint begin_no, CARD_FORMAT format); -static void fork_to_background (void); void set_pre_defined_field (GSList ** pre_defined_fields); /* function declarations*/ @@ -602,38 +601,13 @@ output_n_cards_file (FILE *outputfile, } -static void -fork_to_background (void) -{ -#ifndef G_OS_WIN32 - pid_t pid; - pid = fork (); - if (pid == -1) { - /* ouch, fork() failed */ - perror ("fork"); - exit (-1); - } else if (pid == 0) { - /* child */ - /*contunue */ - - } else { - /* parent exit, note the use of _exit() instead of exit() */ - _exit (-1); - } -#endif -} - static void action_list_cards (GSList *contacts, ActionContext *p_actctx) { FILE *outputfile; long length; - gint IsFirstOne; - gint series_no; - gchar *file_series_name; CARD_FORMAT format; - gint size; length = g_slist_length (contacts); @@ -643,78 +617,25 @@ action_list_cards (GSList *contacts, exit (-1); } - if (p_actctx->action_list_cards.async_mode == FALSE) { /* normal mode */ - - if (p_actctx->action_list_cards.output_file == NULL) { - outputfile = stdout; - } else { - /* fopen output file */ - if (!(outputfile = g_fopen (p_actctx->action_list_cards.output_file, "w"))) { - g_warning (_("Can not open file")); - exit (-1); - } - } - - if (p_actctx->action_list_cards.IsVCard == TRUE) - format = CARD_FORMAT_VCARD; - else - format = CARD_FORMAT_CSV; - - output_n_cards_file (outputfile, contacts, length, 0, format); - - if (p_actctx->action_list_cards.output_file != NULL) { - fclose (outputfile); + if (p_actctx->action_list_cards.output_file == NULL) { + outputfile = stdout; + } else { + /* fopen output file */ + if (!(outputfile = g_fopen (p_actctx->action_list_cards.output_file, "w"))) { + g_warning (_("Can not open file")); + exit (-1); } } - /*async mode */ - else { - - size = p_actctx->action_list_cards.file_size; - IsFirstOne = TRUE; - series_no = 0; - - do { - /* whether it is the last file */ - if ((series_no + 1) * size >= length) { /*last one */ - file_series_name = g_strdup_printf ("%s.end", p_actctx->action_list_cards.output_file); - - } else { /*next one */ - file_series_name = - g_strdup_printf ("%s.%04d", p_actctx->action_list_cards.output_file, series_no); - } - - if (!(outputfile = g_fopen (file_series_name, "w"))) { - g_warning (_("Can not open file")); - exit (-1); - } - - if (p_actctx->action_list_cards.IsVCard == TRUE) - format = CARD_FORMAT_VCARD; - else - format = CARD_FORMAT_CSV; - output_n_cards_file (outputfile, contacts, size, series_no * size, format); - - fclose (outputfile); + if (p_actctx->action_list_cards.IsVCard == TRUE) + format = CARD_FORMAT_VCARD; + else + format = CARD_FORMAT_CSV; - series_no++; + output_n_cards_file (outputfile, contacts, length, 0, format); - if (IsFirstOne == TRUE) { - fork_to_background (); - IsFirstOne = FALSE; - } - - } - while (series_no * size < length); - g_free (file_series_name); -#ifdef G_OS_WIN32 - /* On Unix the parent exits already in - * fork_to_background(), but without fork() exit only - * after doing the job. XXX Is this correct? - */ - if (IsFirstOne == FALSE) - _exit (-1); -#endif + if (p_actctx->action_list_cards.output_file != NULL) { + fclose (outputfile); } } -- cgit v1.2.3