summaryrefslogtreecommitdiff
path: root/src/cgg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgg.c')
-rw-r--r--src/cgg.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cgg.c b/src/cgg.c
index f5776b4..aa8a2ab 100644
--- a/src/cgg.c
+++ b/src/cgg.c
@@ -44,19 +44,21 @@
* parse_cmd: parse commandline and fill global variable parameters
*/
gboolean
-parse_cmd (int argc, char* argv[], char **source_dir, char **dst_dir, gboolean *verbose, int *jobs)
+parse_cmd (int argc, char* argv[], char **source_dir, char **dst_dir, gboolean *verbose, int *jobs, gboolean *update)
{
static gboolean _verbose = FALSE;
static gchar *_source_dir = NULL;
static gchar *_dst_dir = NULL;
static int _jobs = 1;
+ static gboolean _update = 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 path to source structure", 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 },
{ NULL }
};
@@ -73,7 +75,7 @@ parse_cmd (int argc, char* argv[], char **source_dir, char **dst_dir, gboolean *
g_option_context_add_main_entries (context, entries, NULL);
if (argc == 1) {
- s1 = g_option_context_get_help (context, TRUE, NULL);
+ s1 = g_option_context_get_help (context, TRUE, NULL);
g_print ("%s", s1);
g_free (s1);
g_option_context_free (context);
@@ -82,7 +84,7 @@ parse_cmd (int argc, char* argv[], char **source_dir, char **dst_dir, gboolean *
if (! g_option_context_parse (context, &argc, &argv, &error)) {
g_print ("option parsing failed: %s\n", error->message);
- s1 = g_option_context_get_help (context, TRUE, NULL);
+ s1 = g_option_context_get_help (context, TRUE, NULL);
g_print ("%s", s1);
g_free (s1);
g_option_context_free (context);
@@ -94,6 +96,7 @@ parse_cmd (int argc, char* argv[], char **source_dir, char **dst_dir, gboolean *
*dst_dir = _dst_dir;
*verbose = _verbose;
*jobs = _jobs;
+ *update = _update;
return TRUE;
}
@@ -106,6 +109,7 @@ main(int argc, char* argv[])
char *source_dir;
char *dst_dir;
gboolean verbose;
+ gboolean update;
int jobs;
TGallerySetup *setup;
time_t time_start = time (NULL);
@@ -130,7 +134,7 @@ main(int argc, char* argv[])
/* Parse commandline */
- if (! parse_cmd (argc, argv, &source_dir, &dst_dir, &verbose, &jobs))
+ if (! parse_cmd (argc, argv, &source_dir, &dst_dir, &verbose, &jobs, &update))
return -1;
if ((! source_dir) || (access (source_dir, R_OK))) {
@@ -165,6 +169,7 @@ main(int argc, char* argv[])
/* Start building the gallery tree */
setup->verbose = verbose;
+ setup->update_mode = update;
build_tree (setup, source_dir, dst_dir, NULL, -1, jobs);
if (verbose) {