Add command line flag for retrieving the picasso version (fix #11)

This commit is contained in:
fincs 2016-03-26 14:03:02 +01:00
parent e5e8127a5d
commit 08e77dad03
2 changed files with 5 additions and 1 deletions

View File

@ -62,6 +62,7 @@ Usage: picasso [options] files...
Options:
-o, --out=<file> Specifies the name of the SHBIN file to generate
-h, --header=<file> Specifies the name of the header file to generate
-v, --version Displays version information
```
DVLEs are generated in the same order as the files in the command line.

View File

@ -36,6 +36,7 @@ int usage(const char* prog)
"Options:\n"
" -o, --out=<file> Specifies the name of the SHBIN file to generate\n"
" -h, --header=<file> Specifies the name of the header file to generate\n"
" -v, --version Displays version information\n"
, prog);
return EXIT_FAILURE;
}
@ -49,17 +50,19 @@ int main(int argc, char* argv[])
{ "out", required_argument, NULL, 'o' },
{ "header", required_argument, NULL, 'h' },
{ "help", no_argument, NULL, '?' },
{ "version",no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
int opt, optidx = 0;
while ((opt = getopt_long(argc, argv, "o:h:?", long_options, &optidx)) != -1)
while ((opt = getopt_long(argc, argv, "o:h:?v", long_options, &optidx)) != -1)
{
switch (opt)
{
case 'o': shbinFile = optarg; break;
case 'h': hFile = optarg; break;
case '?': usage(argv[0]); return EXIT_SUCCESS;
case 'v': printf("%s - Built on %s %s\n", PACKAGE_STRING, __DATE__, __TIME__); return EXIT_SUCCESS;
default: return usage(argv[0]);
}
}