]> git.tdb.fi Git - ext/subsurface.git/blobdiff - main.c
Add an '--import' command line option
[ext/subsurface.git] / main.c
diff --git a/main.c b/main.c
index be52dbd979c1b81558b892bad4664e45691acd21..642e0727182f75de5fb03047594462ab4f3b0f8e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -139,6 +139,9 @@ void report_dives(void)
        if (last && last->number)
                try_to_renumber(last, preexisting);
 
+       /* did we have dives in the table and added more? */
+       if (last && preexisting != dive_table.nr)
+               mark_divelist_changed(TRUE);
        dive_table.preexisting = dive_table.nr;
        dive_list_update_dives();
 }
@@ -152,6 +155,15 @@ static void parse_argument(const char *arg)
                case 'v':
                        verbose++;
                        continue;
+               case '-':
+                       /* long options with -- */
+                       if (strcmp(arg,"--import") == 0) {
+                               /* mark the dives so far as the base,
+                                * everything after is imported */
+                               report_dives();
+                               return;
+                       }
+                       /* fallthrough */
                default:
                        fprintf(stderr, "Bad argument '%s'\n", arg);
                        exit(1);
@@ -184,6 +196,7 @@ void renumber_dives(int nr)
                struct dive *dive = dive_table.dives[i];
                dive->number = nr + i;
        }
+       mark_divelist_changed(TRUE);
 }
 
 int main(int argc, char **argv)