*/
#include "config.h"
+#include "wayland-version.h"
#include <stdbool.h>
#include <stdio.h>
"headers, server headers, or protocol marshalling code.\n\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " -h, --help display this help and exit.\n"
+ " -v, --version print the wayland library version that\n"
+ " the scanner was built against.\n"
" -c, --include-core-only include the core version of the headers,\n"
" that is e.g. wayland-client-core.h instead\n"
" of wayland-client.h.\n");
exit(ret);
}
+static int
+scanner_version(int ret)
+{
+ fprintf(stderr, "wayland-scanner %s\n", WAYLAND_VERSION);
+ exit(ret);
+}
+
static bool
is_dtd_valid(FILE *input, const char *filename)
{
const char *s = (side == SERVER) ? "SERVER" : "CLIENT";
char **p, *prev;
+ printf("/* Generated by wayland-scanner %s */\n\n", WAYLAND_VERSION);
+
printf("#ifndef %s_%s_PROTOCOL_H\n"
"#define %s_%s_PROTOCOL_H\n"
"\n"
struct wl_array types;
char **p, *prev;
+ printf("/* Generated by wayland-scanner %s */\n\n", WAYLAND_VERSION);
+
if (protocol->copyright)
format_text_to_comment(protocol->copyright, true);
char *input_filename = NULL;
int len;
void *buf;
- bool help = false, core_headers = false;
+ bool help = false;
+ bool core_headers = false;
+ bool version = false;
bool fail = false;
int opt;
enum {
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
{ "include-core-only", no_argument, NULL, 'c' },
{ 0, 0, NULL, 0 }
};
while (1) {
- opt = getopt_long(argc, argv, "hc", options, NULL);
+ opt = getopt_long(argc, argv, "hvc", options, NULL);
if (opt == -1)
break;
case 'h':
help = true;
break;
+ case 'v':
+ version = true;
+ break;
case 'c':
core_headers = true;
break;
if (help)
usage(EXIT_SUCCESS);
+ else if (version)
+ scanner_version(EXIT_SUCCESS);
else if ((argc != 1 && argc != 3) || fail)
usage(EXIT_FAILURE);
else if (strcmp(argv[0], "help") == 0)