ref: d0e0525302190b42d9415c3ca4f37cfc362f69cc
parent: 318c981c007381a5fafc76b6d0bed03653dcf036
author: Antonio Niño Díaz <[email protected]>
date: Thu Jul 13 21:23:25 EDT 2017
Add -V to all programs to show the version This option has been added to all programs of the toolchain, and it prints the version string of the toolchain. Manpages and help command line output updated. Add missing 'w' flag to the command line output of rgbasm. It was correctly documented in the manpages. Signed-off-by: Antonio Niño Díaz <[email protected]>
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -12,6 +12,7 @@
#include "asm/main.h"
#include "extern/err.h"
#include "extern/reallocarray.h"
+#include "extern/version.h"
int yyparse(void);
void setuplex(void);
@@ -276,7 +277,7 @@
usage(void)
{
printf(
-"Usage: rgbasm [-hvE] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
+"Usage: rgbasm [-EhVvw] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
" [-M dependfile] [-o outfile] [-p pad_value] file.asm\n");
exit(1);
}
@@ -322,7 +323,7 @@
newopt = CurrentOptions;
- while ((ch = getopt(argc, argv, "b:D:g:hi:M:o:p:vEw")) != -1) {
+ while ((ch = getopt(argc, argv, "b:D:g:hi:M:o:p:EVvw")) != -1) {
switch (ch) {
case 'b':
if (strlen(optarg) == 2) {
@@ -371,6 +372,9 @@
"between 0 and 0xFF");
}
break;
+ case 'V':
+ printf("rgbasm %s\n", get_package_version_string());
+ exit(0);
case 'v':
newopt.verbose = true;
break;
@@ -382,6 +386,7 @@
break;
default:
usage();
+ /* NOTREACHED */
}
}
argc -= optind;
--- a/src/asm/rgbasm.1
+++ b/src/asm/rgbasm.1
@@ -20,7 +20,7 @@
.Nd Game Boy assembler
.Sh SYNOPSIS
.Nm rgbasm
-.Op Fl Ehvw
+.Op Fl EhVvw
.Op Fl b Ar chars
.Op Fl D Ar name Ns Op = Ns Ar value
.Op Fl g Ar chars
@@ -72,6 +72,8 @@
.It Fl p Ar pad_value
When padding an image, pad with this value.
The default is 0x00.
+.It Fl V
+Print the version of the program and exit.
.It Fl v
Be verbose.
.It Fl w
--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -22,12 +22,13 @@
#include <unistd.h>
#include "extern/err.h"
+#include "extern/version.h"
static void
usage(void)
{
printf(
-"usage: rgbfix [-Ccjsv] [-i game_id] [-k licensee_str] [-l licensee_id]\n"
+"usage: rgbfix [-CcjsVv] [-i game_id] [-k licensee_str] [-l licensee_id]\n"
" [-m mbc_type] [-n rom_version] [-p pad_value] [-r ram_size]\n"
" [-t title_str] file\n");
exit(1);
@@ -69,7 +70,7 @@
int version; /* mask ROM version number */
int padvalue; /* to pad the rom with if it changes size */
- while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:v")) != -1) {
+ while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:Vv")) != -1) {
switch (ch) {
case 'C':
coloronly = true;
@@ -177,6 +178,9 @@
title = optarg;
break;
+ case 'V':
+ printf("rgbfix %s\n", get_package_version_string());
+ exit(0);
case 'v':
validate = true;
break;
--- a/src/fix/rgbfix.1
+++ b/src/fix/rgbfix.1
@@ -20,7 +20,7 @@
.Nd Game Boy checksum fixer
.Sh SYNOPSIS
.Nm rgbfix
-.Op Fl Ccjsv
+.Op Fl CcjsVv
.Op Fl i Ar game_id
.Op Fl k Ar licensee_str
.Op Fl l Ar licensee_id
@@ -108,6 +108,8 @@
.Pc .
If both this and the game ID are set, the game ID will overwrite the
overlapping portion of the title.
+.It Fl V
+Print the version of the program and exit.
.It Fl v
Validate the header and fix checksums: the Nintendo character area
.Pq Ad 0x104 Ns \(en Ns Ad 0x133 ,
--- a/src/gfx/main.c
+++ b/src/gfx/main.c
@@ -14,9 +14,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <getopt.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
+#include "extern/version.h"
#include "gfx/main.h"
static void
@@ -23,8 +25,8 @@
usage(void)
{
printf(
-"usage: rgbgfx [-DFfhPTuv] [-d #] [-o outfile] [-p palfile] [-t mapfile]\n"
-"[-x #] infile\n");
+"usage: rgbgfx [-DFfhPTuVv] [-d #] [-o outfile] [-p palfile] [-t mapfile]\n"
+" [-x #] infile\n");
exit(1);
}
@@ -49,7 +51,7 @@
depth = 2;
- while((ch = getopt(argc, argv, "DvFfd:hx:Tt:uPp:o:")) != -1) {
+ while((ch = getopt(argc, argv, "Dd:Ffho:Tt:uPp:Vvx:")) != -1) {
switch(ch) {
case 'D':
opts.debug = true;
@@ -89,8 +91,12 @@
case 'o':
opts.outfile = optarg;
break;
+ case 'V':
+ printf("rgbgfx %s\n", get_package_version_string());
+ exit(0);
default:
usage();
+ /* NOTREACHED */
}
}
argc -= optind;
--- a/src/gfx/rgbgfx.1
+++ b/src/gfx/rgbgfx.1
@@ -20,7 +20,7 @@
.Nd Game Boy graphics converter
.Sh SYNOPSIS
.Nm rgbgfx
-.Op Fl DfFhPTv
+.Op Fl DfFhPTVv
.Op Fl o Ar outfile
.Op Fl d Ar depth
.Op Fl p Ar palfile
@@ -70,6 +70,8 @@
.Pa .tilemap .
.It Fl u
Truncate repeated tiles. Useful with tilemaps.
+.It Fl V
+Print the version of the program and exit.
.It Fl v
Verbose.
Print errors when the command line parameters and the parameters in
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include "extern/err.h"
+#include "extern/version.h"
#include "link/object.h"
#include "link/output.h"
#include "link/assign.h"
@@ -33,7 +34,7 @@
usage(void)
{
printf(
-"usage: rgblink [-twd] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
+"usage: rgblink [-dtVw] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
exit(1);
}
@@ -52,7 +53,7 @@
if (argc == 1)
usage();
- while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:twd")) != -1) {
+ while ((ch = getopt(argc, argv, "dl:m:n:O:o:p:s:tVw")) != -1) {
switch (ch) {
case 'l':
SetLinkerscriptName(optarg);
@@ -98,7 +99,7 @@
* This option implies OPT_CONTWRAM.
*/
options |= OPT_DMG_MODE;
- /* fallthrough */
+ /* FALLTHROUGH */
case 'w':
/* Set to set WRAM as a single continuous block as on
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
@@ -106,6 +107,9 @@
* will raise an error. */
options |= OPT_CONTWRAM;
break;
+ case 'V':
+ printf("rgblink %s\n", get_package_version_string());
+ exit(0);
default:
usage();
/* NOTREACHED */
--- a/src/link/rgblink.1
+++ b/src/link/rgblink.1
@@ -20,9 +20,7 @@
.Nd Game Boy linker
.Sh SYNOPSIS
.Nm rgblink
-.Op Fl t
-.Op Fl w
-.Op Fl d
+.Op Fl dtVw
.Op Fl m Ar mapfile
.Op Fl n Ar symfile
.Op Fl O Ar overlayfile
@@ -95,6 +93,8 @@
See
.Xr rgblink 5
for more information about its format.
+.It Fl V
+Print the version of the program and exit.
.El
.Sh EXAMPLES
All you need for a basic ROM is an object file, which can be made into a ROM