X-Git-Url: http://git.scottworley.com/tl-append/blobdiff_plain/7521e30b527409a49b129e344b20a87b7d5edf2b..d40078e9e37db7c291a2ed6878e72bc4d5924e5d:/tl-append.c?ds=inline diff --git a/tl-append.c b/tl-append.c index a3e9a4e..52d2602 100644 --- a/tl-append.c +++ b/tl-append.c @@ -27,7 +27,7 @@ typedef struct { } conf_t; void usage() { - die("usage: tl-append [-i] [--no-fnctl-lock] [--no-flock-lock]"); + die("usage: tl-append [-i] [-C dir] [--no-fnctl-lock] [--no-flock-lock]"); } conf_t parse_command_line(int argc, char *argv[]) { @@ -43,7 +43,13 @@ conf_t parse_command_line(int argc, char *argv[]) { conf.fcntl_lock = 0; else if (strcmp(argv[i], "--no-flock-lock") == 0) conf.flock_lock = 0; - else + else if (strcmp(argv[i], "-C") == 0) { + if (i + 1 >= argc) + die("-C requires a directory"); + if (chdir(argv[i + 1]) == -1) + die_err("Couldn't change directory"); + i++; + } else usage(); }