summaryrefslogtreecommitdiff
path: root/5.c
diff options
context:
space:
mode:
Diffstat (limited to '5.c')
-rw-r--r--5.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/5.c b/5.c
index 993c555..df7c8bd 100644
--- a/5.c
+++ b/5.c
@@ -119,8 +119,24 @@ main(int argc, char ** argv)
struct crate ** stack = NULL;
regex_t movecmd;
- while ((i = getopt(argc, argv, "m:")) != -1) {
+ while ((i = getopt(argc, argv, "p:m:")) != -1) {
switch (i) {
+ case 'p':
+ switch (atoi(optarg)) {
+ case 1:
+ crates_move = crates_move_9000;
+ break;
+
+ case 2:
+ crates_move = crates_move_9001;
+ break;
+
+ default:
+ fprintf(stderr, "Unexpected puzzle part %s\n", optarg);
+ return -1;
+ }
+ break;
+
case 'm':
if (strcmp(optarg, "9000") == 0)
crates_move = crates_move_9000;