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.
38 static gboolean sylpheed_initialized = FALSE;
39 static gchar *startup_dir;
42 * Parse program parameters and remove all parameters
43 * that have been processed. Arguments are pointers to
44 * original passed programm arguments and these will
45 * be modified leaving only unknown parameters for
48 * \param argc pointer to number of parameters
49 * \param argv pointer to array of parameter strings
51 static void parse_parameter(int *argc, char ***argv)
55 g_return_if_fail(argc != NULL);
56 g_return_if_fail(argv != NULL);
58 for (i = 1; i < *argc;) {
59 if (strcmp("--debug", (*argv)[i]) == 0) {
68 /* Remove NULL args from argv[] for further processing */
69 for (i = 1; i < *argc; i++) {
70 for (k = i; k < *argc; k++)
71 if ((*argv)[k] != NULL)
76 for (j = i + k; j < *argc; j++)
77 (*argv)[j - k] = (*argv)[j];
83 gboolean sylpheed_init(int *argc, char ***argv)
85 if (sylpheed_initialized)
88 startup_dir = g_get_current_dir();
90 parse_parameter(argc, argv);
92 debug_print("Starting sylpheed version %08x\n", VERSION_NUMERIC);
94 setlocale(LC_ALL, "");
95 bindtextdomain(PACKAGE, LOCALEDIR);
98 /* backup if old rc file exists */
99 if (is_file_exist(RC_DIR)) {
100 if (rename(RC_DIR, RC_DIR ".bak") < 0) {
101 FILE_OP_ERROR(RC_DIR, "rename");
106 srandom((gint)time(NULL));
112 plugin_load_all("Common");
114 sylpheed_initialized = TRUE;
119 void sylpheed_done(void)
121 plugin_unload_all("Common");
128 const gchar *sylpheed_get_startup_dir(void)
133 guint sylpheed_get_version(void)
135 return VERSION_NUMERIC;