Mercurial > hg-old > index.cgi
diff lwar/main.c @ 188:bb2665c7005c
Added --extract and --replace to lwar
author | lost |
---|---|
date | Sun, 22 Mar 2009 06:51:48 +0000 |
parents | cc41ccee8f64 |
children | bae1e3ecdce1 |
line wrap: on
line diff
--- a/lwar/main.c Sun Mar 22 04:24:39 2009 +0000 +++ b/lwar/main.c Sun Mar 22 06:51:48 2009 +0000 @@ -63,16 +63,21 @@ mergeflag = 1; break; -// case 'r': -// // remove members -// operation = LWAR_OP_REMOVE; -// break; + case 'r': + // replace members + operation = LWAR_OP_REPLACE; + break; case 'l': // list members operation = LWAR_OP_LIST; break; + case 'x': + // extract members + operation = LWAR_OP_EXTRACT; + break; + case ARGP_KEY_ARG: if (archive_file) { @@ -91,8 +96,10 @@ static struct argp_option options[] = { -// { "remove", 'r', 0, 0, -// "Remove members from the archive" }, + { "replace", 'r', 0, 0, + "Add or replace archive members" }, + { "extract", 'x', 0, 0, + "Extract members from the archive" }, { "add", 'a', 0, 0, "Add members to the archive" }, { "list", 'l', 0, 0, @@ -117,6 +124,8 @@ extern void do_list(void); extern void do_add(void); extern void do_remove(void); +extern void do_replace(void); +extern void do_extract(void); // main function; parse command line, set up assembler state, and run the // assembler on the first file @@ -135,7 +144,7 @@ exit(1); } - if (operation == LWAR_OP_LIST || operation == LWAR_OP_REMOVE) + if (operation == LWAR_OP_LIST || operation == LWAR_OP_REMOVE || operation == LWAR_OP_EXTRACT) { struct stat stbuf; // make sure the archive exists @@ -186,6 +195,13 @@ do_remove(); break; + case LWAR_OP_REPLACE: + do_replace(); + break; + + case LWAR_OP_EXTRACT: + do_extract(); + break; } exit(0);