as the override palette. In Moo2, this is notably used to select the player
colour for ship images. Colours in the override palette supersede those in
both the base palette and the embedded palette.
+.It Fl V , -version
+Print a version message and exit.
+.It Fl -usage
+Print a short usage message and exit.
+.It Fl -help
+Print a help message and exit
.It Ar frameno ...
Specifies the frames to decode as a sequence of intervals, with frames indexing
from zero. By default, all frames are decoded. Multiplicity is ignored, as is
is -,
.Nm
will read from standard input anyway.
+.It Fl V , -version
+Print a version message and exit.
+.It Fl -usage
+Print a short usage message and exit.
+.It Fl -help
+Print a help message and exit
.It Ar
Limit the operation to these files in the archive. By default, all files are
selected. Supports common shell globbing features.
liblbx_la_SOURCES = byteorder.h misc.h misc.c lbx.c image.c
-lbxtool_SOURCES = lbxtool.c
+lbxtool_SOURCES = tools.h lbxtool.c
lbxtool_LDADD = liblbx.la
if BUILD_LBXIMG
-lbximg_SOURCES = lbximg.c
+lbximg_SOURCES = tools.h lbximg.c
lbximg_LDADD = liblbx.la
lbximg_CFLAGS = $(PNG_CFLAGS)
lbximg_LDFLAGS = $(PNG_LIBS)
#include <png.h>
+#include "tools.h"
#include "image.h"
#include "lbx.h"
static char *outname = "out";
static int usepalette = 1;
+static void printusage(void)
+{
+ puts("usage: lbximg [-i|-d] [-v] [-p palette_file] [-O override_file]"
+ " [-f path]");
+ puts(" [frameno ...]");
+}
+
+static void printhelp(void)
+{
+ printusage();
+ puts("For now, see the man page for detailed help.");
+}
+
static const char *progname;
#define errmsg(fmt, ...) (\
fprintf(stderr, "%s: " fmt, progname, __VA_ARGS__)\
LBX_IMG *img;
int opt;
- static const char *sopts = "idvf:p:O:";
+ static const char *sopts = "idvf:p:O:V";
static const struct option lopts[] = {
{ "ident", 0, NULL, 'i' },
{ "decode", 0, NULL, 'd' },
{ "palette", 1, NULL, 'p' },
{ "override", 1, NULL, 'p' },
+ { "version", 0, NULL, 'V' },
+ { "usage", 0, NULL, 'U' },
+ { "help", 0, NULL, 'H' },
+
{ "nopalette", 0, &usepalette, 0 },
{ 0 }
return EXIT_FAILURE;
}
break;
+ case 'V':
+ puts(VERSION_BOILERPLATE("lbximg"));
+ return EXIT_SUCCESS;
+ case 'U':
+ printusage();
+ return EXIT_SUCCESS;
+ case 'H':
+ printhelp();
+ return EXIT_SUCCESS;
case '?':
case ':':
return EXIT_FAILURE;
#include <getopt.h>
#include <fnmatch.h>
+#include "tools.h"
#include "lbx.h"
+static void printusage(void)
+{
+ puts("usage: lbxtool [-l|-x] [-v] [-f path] [file ...]");
+}
+
+static void printhelp(void)
+{
+ printusage();
+ puts("For now, see the man page for detailed help.");
+}
+
static const char *progname;
#define errmsg(fmt, ...) (\
fprintf(stderr, "%s: " fmt, progname, __VA_ARGS__)\
FILE *f = stdin;
int opt;
- static const char *sopts = "lxf:i:v";
+ static const char *sopts = "lxf:i:vV";
static const struct option lopts[] = {
{ "list", 0, NULL, 'l' },
{ "extract", 0, NULL, 'x' },
{ "verbose", 0, NULL, 'v' },
+ { "version", 0, NULL, 'V' },
+ { "usage", 0, NULL, 'U' },
+ { "help", 0, NULL, 'H' },
+
{ 0 }
};
case 'v':
verbose = 1;
break;
+ case 'V':
+ puts(VERSION_BOILERPLATE("lbxtool"));
+ return EXIT_SUCCESS;
+ case 'U':
+ printusage();
+ return EXIT_SUCCESS;
+ case 'H':
+ printhelp();
+ return EXIT_SUCCESS;
default:
return EXIT_FAILURE;
}