summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgg.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/src/cgg.c b/src/cgg.c
index 6f37760..00101c8 100644
--- a/src/cgg.c
+++ b/src/cgg.c
@@ -39,6 +39,13 @@
+/* Commandline arguments */
+static gchar *source_dir = NULL;
+static gchar *dst_dir = NULL;
+static gboolean verbose = FALSE;
+static gboolean update = FALSE;
+static gboolean fullsize = FALSE;
+static int jobs = 1;
@@ -46,23 +53,16 @@
* parse_cmd: parse commandline and fill global variable parameters
*/
gboolean
-parse_cmd (int argc, char* argv[], gchar **source_dir, gchar **dst_dir, gboolean *verbose, int *jobs, gboolean *update, gboolean *override_nofullsize)
+parse_cmd (int argc, char *argv[])
{
- static gboolean _verbose = FALSE;
- static gchar *_source_dir = NULL;
- static gchar *_dst_dir = NULL;
- static int _jobs = 1;
- static gboolean _update = FALSE;
- static gboolean _override_nofullsize = FALSE;
-
static GOptionEntry entries[] =
{
- { "verbose", 'v', 0, G_OPTION_ARG_NONE, &_verbose, "Be verbose", NULL },
- { "source", 's', 0, G_OPTION_ARG_STRING, &_source_dir, "Specifies a path to source structure", NULL },
- { "output", 'o', 0, G_OPTION_ARG_STRING, &_dst_dir, "Generate files to the specified directory instead of current", NULL },
- { "jobs", 'j', 0, G_OPTION_ARG_INT, &_jobs, "Allow N jobs at once (default=1)", NULL },
- { "update", 'u', 0, G_OPTION_ARG_NONE, &_update, "Update the output structure", NULL },
- { "fullsize", 'f', 0, G_OPTION_ARG_NONE, &_override_nofullsize, "Override the nofullsize switch and generate full gallery", NULL },
+ { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
+ { "source", 's', 0, G_OPTION_ARG_STRING, &source_dir, "Specifies a path to source structure", NULL },
+ { "output", 'o', 0, G_OPTION_ARG_STRING, &dst_dir, "Generate files to the specified directory instead of current", NULL },
+ { "jobs", 'j', 0, G_OPTION_ARG_INT, &jobs, "Allow N jobs at once (default=1)", NULL },
+ { "update", 'u', 0, G_OPTION_ARG_NONE, &update, "Update the output structure", NULL },
+ { "fullsize", 'f', 0, G_OPTION_ARG_NONE, &fullsize, "Override the nofullsize switch and generate full gallery", NULL },
{ NULL }
};
@@ -96,13 +96,6 @@ parse_cmd (int argc, char* argv[], gchar **source_dir, gchar **dst_dir, gboolean
}
g_option_context_free (context);
- *source_dir = _source_dir;
- *dst_dir = _dst_dir;
- *verbose = _verbose;
- *jobs = _jobs;
- *update = _update;
- *override_nofullsize = _override_nofullsize;
-
return TRUE;
}
@@ -111,12 +104,6 @@ parse_cmd (int argc, char* argv[], gchar **source_dir, gchar **dst_dir, gboolean
int
main (int argc, char* argv[])
{
- gchar *source_dir;
- gchar *dst_dir;
- gboolean verbose;
- gboolean update;
- gboolean fullsize;
- int jobs;
TGallerySetup *setup;
time_t time_start = time (NULL);
time_t time_stop;
@@ -134,14 +121,10 @@ main (int argc, char* argv[])
/* Initialize ImageMagick at this point, for multithreading safety */
MagickWandGenesis();
-
- source_dir = NULL;
- dst_dir = NULL;
setup = g_malloc0 (sizeof (TGallerySetup));
-
/* Parse commandline */
- if (! parse_cmd (argc, argv, &source_dir, &dst_dir, &verbose, &jobs, &update, &fullsize))
+ if (! parse_cmd (argc, argv))
return -1;
if ((! source_dir) || (access (source_dir, R_OK))) {
@@ -232,5 +215,5 @@ main (int argc, char* argv[])
g_free (dst_dir);
free_setup_data (setup);
- return (0);
+ return 0;
}