sync with sylpheed 0.7.1cvs8

This commit is contained in:
Paul Mangan 2002-02-14 15:28:02 +00:00
parent 3f304f560e
commit 00cafee47a
16 changed files with 124 additions and 195 deletions

View file

@ -1,3 +1,31 @@
2002-02-14
* src/utils.c: strsplit_with_quote(): remove quotation characters
in the function (fix composer's external editor problem) (thanks
to Stefaan A Eeckels).
* src/mainwindow.[ch]: made 'Show all header' toggle switch.
main_window_menu_callback_block()
main_window_menu_callback_unblock(): new.
main_window_set_menu_sensitive(): set the toggle status of
menu items.
show_all_header_cb(): read the status of toggle menu item.
* src/mainwindow.[ch]: made 'Thread view' toggle switch.
* src/prefs_common.c: prefs_keybind_apply_clicked(): removed
'Unthread view'.
2002-02-13
* src/imap.c: imap_add_msg(): fixed a bug that didn't replace
the path separator (thanks to Sergey Vlasov).
* src/gtkutils.c: gtkut_editable_get_selection(): return NULL
if the length of selection is zero.
Fixed the assertion.
* src/utils.c: str_open_as_stream(): return immediately if
the length of str is zero.
* src/headerwindow.[ch]: removed.
* src/socket.[ch]
src/inc.c: removed stale thread support codes.
2002-02-12
* src/procmsg.c: procmsg_open_message(): modified so that it

View file

@ -1,3 +1,11 @@
2002-02-14 [paul] 0.7.1claws1
* sync with sylpheed 0.7.1cvs8
see ChangeLog entries 2002-02-13 and 2002-02-14
* README.claws
add some description of Actions and Pixmap Themes
2002-02-13 [paul]
* version 0.7.1claws release

View file

@ -1,3 +1,31 @@
2002-02-14
* src/utils.c: strsplit_with_quote(): この関数中で引用文字を削除
するようにした(メッセージ作成の外部エディタの問題を修正)
(Stefaan A Eeckels さん thanks)。
* src/mainwindow.[ch]: 「全てのヘッダを表示」をトグルスイッチにした。
main_window_menu_callback_block()
main_window_menu_callback_unblock(): 新規。
main_window_set_menu_sensitive(): メニューアイテムのトグル状態を
セット。
show_all_header_cb(): トグルメニューアイテムの状態を読むようにした。
* src/mainwindow.[ch]: 「スレッド表示」をトグルスイッチにした。
* src/prefs_common.c: prefs_keybind_apply_clicked(): 「スレッド解除」
を削除。
2002-02-13
* src/imap.c: imap_add_msg(): パス区切りを変換していなかったバグを
修正(Sergey Vlasov さん thanks)。
* src/gtkutils.c: gtkut_editable_get_selection(): 選択部の長さが
0 のときは NULL を返すようにした。
アサーションを修正。
* src/utils.c: str_open_as_stream(): str の長さが 0 のときはすぐに
戻るようにした。
* src/headerwindow.[ch]: 削除。
* src/socket.[ch]
src/inc.c: 古いスレッド対応コードを削除。
2002-02-12
* src/procmsg.c: procmsg_open_message(): デコードされたメッセージ

View file

@ -8,7 +8,7 @@ MINOR_VERSION=7
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=claws
EXTRA_VERSION=claws1
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target

View file

@ -23,6 +23,7 @@ sylpheed_SOURCES = \
compose.c compose.h \
gtkshruler.c gtkshruler.h \
gtksctree.c gtksctree.h \
gtkstext.c gtkstext.h \
menu.c menu.h \
stock_pixmap.c stock_pixmap.h \
prefs.c prefs.h \
@ -66,7 +67,6 @@ sylpheed_SOURCES = \
filesel.c filesel.h \
foldersel.c foldersel.h \
statusbar.c statusbar.h \
headerwindow.c headerwindow.h \
logwindow.c logwindow.h \
sourcewindow.c sourcewindow.h \
manage_window.c manage_window.h \
@ -114,7 +114,6 @@ sylpheed_SOURCES = \
simple-gettext.c \
manual.c manual.h \
stringtable.c stringtable.h \
gtkstext.c gtkstext.h \
scoring.c scoring.h \
prefs_folder_item.c prefs_folder_item.h \
matcher.c matcher.h \

View file

@ -254,13 +254,13 @@ gchar *gtkut_editable_get_selection(GtkEditable *editable)
{
guint start_pos, end_pos;
g_return_if_fail(editable != NULL);
g_return_val_if_fail(editable != NULL, NULL);
if (!editable->has_selection) return NULL;
if (editable->selection_start_pos == editable->selection_end_pos)
return NULL;
if (editable->selection_start_pos < editable->selection_end_pos) {
start_pos = editable->selection_start_pos;
end_pos = editable->selection_end_pos;

View file

@ -597,12 +597,11 @@ gint imap_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
g_return_val_if_fail(file != NULL, -1);
session = imap_session_get(folder);
if (!session)
return -1;
if (!session) return -1;
destdir = imap_get_real_path(IMAP_FOLDER(folder), dest->path);
ok = imap_cmd_append(SESSION(session)->sock, destdir, file);
g_free (destdir);
g_free(destdir);
if (ok != IMAP_SUCCESS) {
g_warning(_("can't append message %s\n"), file);

View file

@ -96,10 +96,6 @@ static gint pop3_automaton_terminate (SockInfo *source,
static GHashTable *inc_get_uidl_table (PrefsAccount *ac_prefs);
static void inc_write_uidl_list (Pop3State *state);
#if USE_THREADS
static gint connection_check_cb (Automaton *atm);
#endif
static void inc_pop3_recv_func (SockInfo *sock,
gint count,
gint read_bytes,
@ -600,11 +596,7 @@ static IncState inc_pop3_session_do(IncSession *session)
GTK_EVENTS_FLUSH();
statusbar_pop_all();
#if USE_THREADS
if ((sockinfo = sock_connect_with_thread(server, port)) == NULL) {
#else
if ((sockinfo = sock_connect(server, port)) == NULL) {
#endif
log_warning(_("Can't connect to POP3 server: %s:%d\n"),
server, port);
if(!prefs_common.noerrorpanel) {
@ -637,14 +629,9 @@ static IncState inc_pop3_session_do(IncSession *session)
log_verbosity_set(TRUE);
recv_set_ui_func(inc_pop3_recv_func, session);
#if USE_THREADS
atm->timeout_tag = gtk_timeout_add
(TIMEOUT_ITV, (GtkFunction)connection_check_cb, atm);
#else
atm->tag = sock_gdk_input_add(sockinfo,
atm->state[atm->num].condition,
automaton_input_cb, atm);
#endif
while (!atm->terminated)
gtk_main_iteration();
@ -652,9 +639,6 @@ static IncState inc_pop3_session_do(IncSession *session)
log_verbosity_set(FALSE);
recv_set_ui_func(NULL, NULL);
#if USE_THREADS
/* pthread_join(sockinfo->connect_thr, NULL); */
#endif
automaton_destroy(atm);
return pop3_state->inc_state;
@ -741,44 +725,6 @@ static void inc_write_uidl_list(Pop3State *state)
g_free(path);
}
#if USE_THREADS
static gint connection_check_cb(Automaton *atm)
{
Pop3State *state = atm->data;
IncProgressDialog *inc_dialog = state->session->data;
SockInfo *sockinfo = state->sockinfo;
/* g_print("connection check\n"); */
if (sockinfo->state == CONN_LOOKUPFAILED ||
sockinfo->state == CONN_FAILED) {
atm->timeout_tag = 0;
log_warning(_("Can't connect to POP3 server: %s:%d\n"),
sockinfo->hostname, sockinfo->port);
if(!prefs_common.noerrorpanel) {
if((prefs_common.recv_dialog_mode == RECV_DIALOG_ALWAYS) ||
((prefs_common.recv_dialog_mode == RECV_DIALOG_ACTIVE) && focus_window)) {
manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
}
alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
sockinfo->hostname, sockinfo->port);
manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
}
pop3_automaton_terminate(sockinfo, atm);
state->sockinfo = NULL;
return FALSE;
} else if (sockinfo->state == CONN_ESTABLISHED) {
atm->timeout_tag = 0;
atm->tag = sock_gdk_input_add(sockinfo,
atm->state[atm->num].condition,
automaton_input_cb, atm);
return FALSE;
} else {
return TRUE;
}
}
#endif
static void inc_pop3_recv_func(SockInfo *sock, gint count, gint read_bytes,
gpointer data)
{
@ -962,15 +908,6 @@ static void inc_cancel(GtkWidget *widget, gpointer data)
if (!sockinfo || session->atm->terminated == TRUE) return;
#if USE_THREADS
if (sockinfo->state == CONN_READY ||
sockinfo->state == CONN_LOOKUPSUCCESS) {
pthread_cancel(sockinfo->connect_thr);
/* pthread_kill(sockinfo->connect_thr, SIGINT); */
g_print("connection was cancelled.\n");
}
#endif
session->pop3_state->inc_state = INC_CANCEL;
pop3_automaton_terminate(sockinfo, session->atm);
session->pop3_state->sockinfo = NULL;

View file

@ -70,7 +70,6 @@
#include "prefs_template.h"
#include "account.h"
#include "addressbook.h"
#include "headerwindow.h"
#include "logwindow.h"
#include "manage_window.h"
#include "alertpanel.h"
@ -103,6 +102,9 @@ static GList *mainwin_list = NULL;
static GdkCursor *watch_cursor;
static void main_window_menu_callback_block (MainWindow *mainwin);
static void main_window_menu_callback_unblock (MainWindow *mainwin);
static void main_window_show_cur_account (MainWindow *mainwin);
static void main_window_set_widgets (MainWindow *mainwin,
@ -502,8 +504,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
{N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View/_Sort/_Attract by subject"),
NULL, attract_by_subject_cb, 0, NULL},
{N_("/_View/Th_read view"), "<control>T", thread_cb, 0, NULL},
{N_("/_View/U_nthread view"), "<shift><control>T", thread_cb, 1, NULL},
{N_("/_View/Th_read view"), "<control>T", thread_cb, 0, "<ToggleItem>"},
{N_("/_View/_Hide read messages"), NULL, hide_read_messages, 0, "<ToggleItem>"},
{N_("/_View/Set display _item..."), NULL, set_display_item_cb, 0, NULL},
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
@ -610,7 +611,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View/Open in new _window"), "<control><alt>N", open_msg_cb, 0, NULL},
{N_("/_View/_View source"), "<control>U", view_source_cb, 0, NULL},
{N_("/_View/Show all _header"), "<control>H", show_all_header_cb, 0, NULL},
{N_("/_View/Show all _header"), "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View/_Update"), "<control><alt>U", update_summary_cb, 0, NULL},
@ -853,7 +854,6 @@ MainWindow *main_window_create(SeparateType type)
mainwin->folderview = folderview = folderview_create();
mainwin->summaryview = summaryview = summary_create();
mainwin->messageview = messageview = messageview_create();
mainwin->headerwin = header_window_create();
mainwin->logwin = log_window_create();
folderview->mainwin = mainwin;
@ -862,7 +862,6 @@ MainWindow *main_window_create(SeparateType type)
summaryview->mainwin = mainwin;
summaryview->folderview = folderview;
summaryview->messageview = messageview;
summaryview->headerwin = mainwin->headerwin;
summaryview->window = window;
messageview->mainwin = mainwin;
@ -980,11 +979,6 @@ MainWindow *main_window_create(SeparateType type)
menuitem = gtk_item_factory_get_item(ifactory, "/View/Expand Summary View");
gtk_signal_connect(GTK_OBJECT(menuitem), "state-changed", GTK_SIGNAL_FUNC(menuitem_expandsummaryview_statechanged),
mainwin);
menu_set_sensitive(ifactory, "/View/Thread view",
prefs_common.enable_thread ? FALSE : TRUE);
menu_set_sensitive(ifactory, "/View/Unthread view",
prefs_common.enable_thread ? TRUE : FALSE);
/* set account selection menu */
ac_menu = gtk_item_factory_get_widget
@ -1010,10 +1004,10 @@ MainWindow *main_window_create(SeparateType type)
folderview_init(folderview);
summary_init(summaryview);
messageview_init(messageview);
header_window_init(mainwin->headerwin);
log_window_init(mainwin->logwin);
mainwin->lock_count = 0;
mainwin->menu_lock_count = 0;
mainwin->cursor_count = 0;
if (!watch_cursor)
@ -1070,6 +1064,17 @@ void main_window_unlock(MainWindow *mainwin)
gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
}
static void main_window_menu_callback_block(MainWindow *mainwin)
{
mainwin->menu_lock_count++;
}
static void main_window_menu_callback_unblock(MainWindow *mainwin)
{
if (mainwin->menu_lock_count)
mainwin->menu_lock_count--;
}
void main_window_reflect_prefs_all(void)
{
GList *cur;
@ -1497,6 +1502,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
GtkItemFactory *ifactory;
SensitiveCond state;
gboolean sensitive;
GtkWidget *menuitem;
gint i;
static const struct {
@ -1517,8 +1523,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
{"/Edit/Actions" , M_MSG_EXIST},
{"/View/Sort" , M_MSG_EXIST},
{"/View/Thread view" , M_UNTHREADED},
{"/View/Unthread view" , M_THREADED},
{"/View/Thread view" , M_EXEC},
{"/View/Hide read messages" , M_HIDE_READ_MSG},
{"/View/Go to/Prev message" , M_MSG_EXIST},
{"/View/Go to/Next message" , M_MSG_EXIST},
@ -1565,6 +1570,14 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
sensitive = ((entry[i].cond & state) == entry[i].cond);
menu_set_sensitive(ifactory, entry[i].entry, sensitive);
}
main_window_menu_callback_block(mainwin);
menuitem = gtk_item_factory_get_widget(ifactory, "/View/Show all header");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
menuitem = gtk_item_factory_get_widget(ifactory, "/View/Thread view");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
(state & M_THREADED) != 0);
main_window_menu_callback_unblock(mainwin);
}
void main_window_popup(MainWindow *mainwin)
@ -2626,7 +2639,9 @@ static void view_source_cb(MainWindow *mainwin, guint action,
static void show_all_header_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
summary_display_msg_selected(mainwin->summaryview, TRUE);
if (mainwin->menu_lock_count) return;
summary_display_msg_selected(mainwin->summaryview,
GTK_CHECK_MENU_ITEM(widget)->active);
}
static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
@ -2695,20 +2710,17 @@ static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
{
GtkItemFactory *ifactory;
if (mainwin->menu_lock_count) return;
if (!mainwin->summaryview->folder_item) return;
ifactory = gtk_item_factory_from_widget(widget);
if (0 == action) {
if (GTK_CHECK_MENU_ITEM(widget)->active) {
summary_thread_build(mainwin->summaryview);
mainwin->summaryview->folder_item->threaded = TRUE;
menu_set_sensitive(ifactory, "/View/Thread view", FALSE);
menu_set_sensitive(ifactory, "/View/Unthread view", TRUE);
} else {
summary_unthread(mainwin->summaryview);
mainwin->summaryview->folder_item->threaded = FALSE;
menu_set_sensitive(ifactory, "/View/Thread view", TRUE);
menu_set_sensitive(ifactory, "/View/Unthread view", FALSE);
}
}

View file

@ -28,7 +28,6 @@ typedef struct _MainWindow MainWindow;
#include "summaryview.h"
#include "headerview.h"
#include "messageview.h"
#include "headerwindow.h"
#include "logwindow.h"
typedef enum
@ -131,12 +130,12 @@ struct _MainWindow
ToolbarStyle toolbar_style;
guint lock_count;
guint menu_lock_count;
guint cursor_count;
FolderView *folderview;
SummaryView *summaryview;
MessageView *messageview;
HeaderWindow *headerwin;
LogWindow *logwin;
};

View file

@ -3619,7 +3619,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
"(menu-path \"<Main>/View/Expand Summary View\" \"V\")\n"
"(menu-path \"<Main>/View/Expand Message View\" \"<shift>V\")\n"
"(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
"(menu-path \"<Main>/View/Unthread view\" \"<shift><control>T\")\n"
"(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
"(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
"(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
@ -3672,7 +3671,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
"(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
"(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
"(menu-path \"<Main>/View/Thread view\" \"<shift>T\")\n"
"(menu-path \"<Main>/View/Unthread view\" \"<shift><control>T\")\n"
"(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
"(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
"(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
@ -3724,7 +3722,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
"(menu-path \"<Main>/View/Toggle summary view\" \"V\")\n"
"(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
"(menu-path \"<Main>/View/Unthread view\" \"<shift><control>T\")\n"
"(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
"(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
"(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"
@ -3777,7 +3774,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
"(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
"(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
"(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
"(menu-path \"<Main>/View/Unthread view\" \"<shift><control>T\")\n"
"(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
"(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
"(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
@ -3830,7 +3826,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
"(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
"(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
"(menu-path \"<Main>/View/Thread view\" \"\")\n"
"(menu-path \"<Main>/View/Unthread view\" \"\")\n"
"(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
"(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
"(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"

View file

@ -37,10 +37,6 @@
#include <fcntl.h>
#include <errno.h>
#if USE_THREADS
# include <pthread.h>
#endif
#include "socket.h"
#include "utils.h"
#if USE_SSL
@ -336,55 +332,6 @@ static SockInfo *sockinfo_from_fd(const gchar *hostname,
return sockinfo;
}
#if USE_THREADS
static void sock_connect_thread(SockInfo *sockinfo)
{
#ifdef INET6
if ((sockinfo->sock = sock_connect_by_getaddrinfo
(sockinfo->hostname, sockinfo->port)) < 0)
pthread_exit((void *)1);
#else
if (sock_connect_by_hostname(sockinfo->sock, sockinfo->hostname,
sockinfo->port) < 0) {
if (errno != 0) perror("connect");
sockinfo->state = CONN_FAILED;
pthread_exit((void *)1);
}
#endif /* INET6 */
sockinfo->state = CONN_ESTABLISHED;
pthread_exit(0);
}
SockInfo *sock_connect_with_thread(const gchar *hostname, gushort port)
{
gint sock = 0;
SockInfo *sockinfo;
#ifndef INET6
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
perror("socket");
return NULL;
}
#endif /* !INET6 */
sockinfo = g_new0(SockInfo, 1);
sockinfo->sock = sock;
sockinfo->hostname = g_strdup(hostname);
sockinfo->port = port;
sockinfo->state = CONN_READY;
pthread_create(&sockinfo->connect_thr, NULL,
(void *)sock_connect_thread,
sockinfo);
pthread_mutex_init(&sockinfo->mutex, NULL);
pthread_detach(sockinfo->connect_thr);
return sockinfo;
}
#endif
gint sock_printf(SockInfo *sock, const gchar *format, ...)
{
va_list args;

View file

@ -27,10 +27,6 @@
#include <glib.h>
#include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
#if USE_THREADS
# include <pthread.h>
#endif
typedef struct _SockInfo SockInfo;
#if USE_SSL
@ -59,10 +55,6 @@ struct _SockInfo
gushort port;
ConnectionState state;
gpointer data;
#if USE_THREADS
pthread_t connect_thr;
pthread_mutex_t mutex;
#endif
#if USE_SSL
SSL *ssl;
#endif
@ -75,10 +67,6 @@ SockInfo *sock_connect_nb (const gchar *hostname, gushort port);
SockInfo *sock_connect (const gchar *hostname, gushort port);
SockInfo *sock_connect_cmd (const gchar *hostname, const gchar *tunnelcmd);
#if USE_THREADS
SockInfo *sock_connect_with_thread (const gchar *hostname, gushort port);
#endif
gint sock_printf (SockInfo *sock, const gchar *format, ...)
G_GNUC_PRINTF(2, 3);
gint sock_read (SockInfo *sock, gchar *buf, gint len);

View file

@ -58,7 +58,6 @@
#include "foldersel.h"
#include "procmsg.h"
#include "procheader.h"
#include "headerwindow.h"
#include "sourcewindow.h"
#include "prefs_common.h"
#include "prefs_summary_column.h"
@ -2371,11 +2370,6 @@ static void summary_display_msg_full(SummaryView *summaryview,
summary_status_show(summaryview);
}
#if 0
if (GTK_WIDGET_VISIBLE(summaryview->headerwin->window))
header_window_show(summaryview->headerwin, msginfo);
#endif
summary_unlock(summaryview);
}

View file

@ -34,7 +34,6 @@ typedef struct _SummaryColumnState SummaryColumnState;
#include "folderview.h"
#include "headerview.h"
#include "messageview.h"
#include "headerwindow.h"
#include "compose.h"
#include "prefs_filter.h"
#include "folder.h"
@ -132,7 +131,6 @@ struct _SummaryView
FolderView *folderview;
HeaderView *headerview;
MessageView *messageview;
HeaderWindow *headerwin;
FolderItem *folder_item;

View file

@ -1067,8 +1067,8 @@ gchar **strsplit_with_quote(const gchar *str, const gchar *delim,
gint max_tokens)
{
GSList *string_list = NULL, *slist;
gchar **str_array, *s;
guint i, n = 1;
gchar **str_array, *s, *new_str;
guint i, n = 1, len;
g_return_val_if_fail(str != NULL, NULL);
g_return_val_if_fail(delim != NULL, NULL);
@ -1081,13 +1081,15 @@ gchar **strsplit_with_quote(const gchar *str, const gchar *delim,
guint delimiter_len = strlen(delim);
do {
guint len;
gchar *new_str;
len = s - str;
new_str = g_new(gchar, len + 1);
strncpy(new_str, str, len);
new_str[len] = 0;
new_str = g_strndup(str, len);
if (new_str[0] == '\'' || new_str[0] == '\"') {
if (new_str[len - 1] == new_str[0]) {
new_str[len - 1] = '\0';
memmove(new_str, new_str + 1, len - 1);
}
}
string_list = g_slist_prepend(string_list, new_str);
n++;
str = s + delimiter_len;
@ -1096,8 +1098,16 @@ gchar **strsplit_with_quote(const gchar *str, const gchar *delim,
}
if (*str) {
new_str = g_strdup(str);
if (new_str[0] == '\'' || new_str[0] == '\"') {
len = strlen(str);
if (new_str[len - 1] == new_str[0]) {
new_str[len - 1] = '\0';
memmove(new_str, new_str + 1, len - 1);
}
}
string_list = g_slist_prepend(string_list, new_str);
n++;
string_list = g_slist_prepend(string_list, g_strdup(str));
}
str_array = g_new(gchar*, n);
@ -1856,6 +1866,8 @@ FILE *str_open_as_stream(const gchar *str)
}
len = strlen(str);
if (len == 0) return fp;
if (fwrite(str, len, 1, fp) != 1) {
FILE_OP_ERROR("str_open_as_stream", "fwrite");
fclose(fp);
@ -1922,25 +1934,10 @@ gint execute_sync(gchar *const argv[])
gint execute_command_line(const gchar *cmdline, gboolean async)
{
gchar **argv;
gint i;
gint ret;
argv = strsplit_with_quote(cmdline, " ", 0);
for (i = 0; argv[i] != NULL; i++) {
gchar *str = argv[i];
if (str[0] == '\'' || str[0] == '\"') {
gint len;
len = strlen(str);
if (str[len - 1] == str[0]) {
str[len - 1] = '\0';
memmove(str, str + 1, len - 1);
}
}
}
if (async)
ret = execute_async(argv);
else