+/*
+ * Version string boilerplate for slide puzzle game.
+ * Copyright © 2022-2023 Nick Bowler
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
#include <config.h>
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
-#include <striconv.h>
#include <localcharset.h>
#include "version.h"
+#include "copysym.h"
-const char *init_copysign(char **alloc)
-{
- *alloc = NULL;
-
- if (ENABLE_NLS) {
- char *buf = str_iconv("\xc2\xa9", "UTF-8", locale_charset());
- if (buf)
- return *alloc = buf;
- }
-
- return "(C)";
-}
-
-#define VERSION_HEAD_FMT "%s (RRace) %s\nCopyright %s 2022 Nick Bowler"
+#define VERSION_HEAD_FMT "%s (RRace) %s\nCopyright %s 2023 Nick Bowler"
#define VERSION_HEAD_ARGS progname, PACKAGE_VERSION, copysign
void version_print_head(const char *progname, FILE *f)
{
- const char *copysign;
- char *copybuf;
-
- copysign = init_copysign(©buf);
+ const char *copysign = copyright_symbol(locale_charset());
printf(VERSION_HEAD_FMT, VERSION_HEAD_ARGS);
putc('\n', f);
-
- free(copybuf);
}
char *version_format_head(const char *progname)
{
- const char *copysign;
- char *copybuf, *ret;
-
- copysign = init_copysign(©buf);
+ const char *copysign = copyright_symbol(locale_charset());
+ char *ret;
ret = malloc(sizeof VERSION_HEAD_FMT + 100);
if (ret)
sprintf(ret, VERSION_HEAD_FMT, VERSION_HEAD_ARGS);
- free(copybuf);
return ret;
}