2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999,2000 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 static gboolean sylpheed_initialized = FALSE;
40 static gchar *startup_dir;
43 * Parse program parameters and remove all parameters
44 * that have been processed. Arguments are pointers to
45 * original passed programm arguments and these will
46 * be modified leaving only unknown parameters for
49 * \param argc pointer to number of parameters
50 * \param argv pointer to array of parameter strings
52 static void parse_parameter(int *argc, char ***argv)
56 g_return_if_fail(argc != NULL);
57 g_return_if_fail(argv != NULL);
59 for (i = 1; i < *argc;) {
60 if (strcmp("--debug", (*argv)[i]) == 0) {
69 /* Remove NULL args from argv[] for further processing */
70 for (i = 1; i < *argc; i++) {
71 for (k = i; k < *argc; k++)
72 if ((*argv)[k] != NULL)
77 for (j = i + k; j < *argc; j++)
78 (*argv)[j - k] = (*argv)[j];
84 gboolean sylpheed_init(int *argc, char ***argv)
86 if (sylpheed_initialized)
89 startup_dir = g_get_current_dir();
91 parse_parameter(argc, argv);
93 debug_print("Starting sylpheed version %08x\n", VERSION_NUMERIC);
95 setlocale(LC_ALL, "");
96 bindtextdomain(PACKAGE, LOCALEDIR);
97 bind_textdomain_codeset (PACKAGE, "UTF-8");
99 putenv("G_BROKEN_FILENAMES=1");
101 /* backup if old rc file exists */
102 if (is_file_exist(RC_DIR)) {
103 if (rename(RC_DIR, RC_DIR ".bak") < 0) {
104 FILE_OP_ERROR(RC_DIR, "rename");
109 srandom((gint)time(NULL));
115 plugin_load_all("Common");
117 sylpheed_initialized = TRUE;
122 void sylpheed_done(void)
124 plugin_unload_all("Common");
131 const gchar *sylpheed_get_startup_dir(void)
136 guint sylpheed_get_version(void)
138 return VERSION_NUMERIC;