diff options
| author | jakob <jakob@memeware.net> | 2017-06-01 17:37:20 -0400 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-06-01 17:37:20 -0400 |
| commit | 6adad1bfad91274aad030cf6167c1f19fb602d62 (patch) | |
| tree | b26b6397fdde7b89cb7dcfa1b7c68ff61830230b /src/cli.c | |
| parent | 311bb17b20c4fdbb1af29bf66ab01d0309ee0efe (diff) | |
Initial working XP3 creation.
Diffstat (limited to 'src/cli.c')
| -rw-r--r-- | src/cli.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with Nekopack. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -25,6 +26,8 @@ #include "cli.h" #include "crypto.h" +#define NEKOPACK_VERSION "2.1.0b1" + /* Copies `optarg` into the out field of `p` and ensures that it ends in a trailing path delimiter. */ @@ -64,6 +67,7 @@ struct params parse_args(int argc, char **argv) { p.mode = USAGE; return p; } + p.mode = EXTRACT; int cur = 0, opt_index = 0, count = 0; @@ -86,25 +90,33 @@ struct params parse_args(int argc, char **argv) { case 'h': p.mode = HELP; return p; + case 'V': p.mode = VERSION; return p; + case 'v': p.verbose = true; break; + case 'o': count++; parse_output_path(optarg, &p); break; + case 'g': count++; parse_game_id(optarg, &p); + break; + case 'e': p.mode = EXTRACT; break; + case 'l': p.mode = LIST; break; + case 'c': p.mode = CREATE; } @@ -124,3 +136,33 @@ struct params parse_args(int argc, char **argv) { return p; } + + +void print_usage(char *progn) { + fprintf(stderr, "Usage: %s [OPTIONS] (ARCHIVES) [PATHS]\n", progn); +} + + +void print_version(void) { + printf("Nekopack version %s\nProgrammed by Jakob. " + "<http://jakob.space>\n", NEKOPACK_VERSION); +} + + +void print_help(void) { + printf("A tool for decompressing the XP3 archives used by Nekopara.\n\n" + " -h, --help\t\tDisplay this help page and exit.\n" + " -v, --version\tDisplay the currently installed version and " + "exit.\n\n" + " -e, --extract\tExtract the contents of the archive. This is " + "the default\n\t\t\taction if no mode argument is provided.\n" + " -l, --list\t\tList the contents of the archive.\n" + " -c, --create\t\tCreate a new XP3 archive.\n\n" + " -o, --output\t\tPath to extract files to.\n" + " -g, --game\t\tGame the archive is from. Required for file " + "decryption.\n" + " -q, --quiet\t\tDon't display information about extracted " + "files.\n\n" + "Supported games: nekopara_volume_0, nekopara_volume_0_steam,\n" + "nekopara_volume_1, nekopara_volume_1_steam\n"); +} |