aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--FICS/comproc.c5
-rw-r--r--FICS/playerdb.c12
-rw-r--r--FICS/vers.c2
-rw-r--r--include/colors.h81
5 files changed, 91 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a3e816..8aab73c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
All notable changes to this fork of FICS version 1.6.2 will be
documented in this file.
-## [Unreleased] ##
+## [1.4.5] - 2025-04-09 ##
- **Changed** the addplayer program to output a restart notice if an admin
account is created.
- **Changed** the program to avoid calculating the same string multiple
@@ -15,7 +15,7 @@ documented in this file.
- **Fixed** excessive checks.
- **Fixed** improper use of negative values.
- **Fixed** memory leak in `process_login()`.
-- **Fixed** multiple Clang Tidy warnings.
+- **Fixed** _multiple_ Clang Tidy warnings.
- **Fixed** negative array index read in `accept_match()`.
- **Fixed** null pointer dereferences.
- **Fixed** out-of-bounds array access in `has_legal_move()`.
diff --git a/FICS/comproc.c b/FICS/comproc.c
index 861655e..2b5a04e 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -1320,10 +1320,7 @@ com_who(int p, param_list param)
sel_bits |= WHO_REGISTERED;
break;
case 'l': // Sort order
- cmp_func = alpha_cmp;
- sort_type = none;
- break;
- case 'A': // Sort order
+ case 'A':
cmp_func = alpha_cmp;
sort_type = none;
break;
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index b2d1806..c85ec0c 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -587,17 +587,17 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version)
pp->timeOfReg = array[0];
pp->totalTime = array[1];
- if (pp->num_plan > MAX_PLAN) {
+ if (pp->num_plan >= MAX_PLAN) {
warnx("Player %s is corrupt\nToo many plans (%d)",
parray[p].name,
pp->num_plan);
return;
- } else if (pp->num_formula > MAX_FORMULA) {
+ } else if (pp->num_formula >= MAX_FORMULA) {
warnx("Player %s is corrupt\nToo many formulas (%d)",
parray[p].name,
pp->num_formula);
return;
- } else if (pp->numAlias > MAX_ALIASES) {
+ } else if (pp->numAlias >= MAX_ALIASES) {
warnx("Player %s is corrupt\nToo many aliases (%d)",
parray[p].name,
pp->numAlias);
@@ -859,7 +859,7 @@ got_attr_value_player(int p, char *attr, char *value, FILE *fp, char *file)
* num_plan
*/
- if ((parray[p].num_plan = atoi(value)) > MAX_PLAN) {
+ if ((parray[p].num_plan = atoi(value)) >= MAX_PLAN) {
warnx("%s: %s: too many plans (%d)", __func__, file,
parray[p].num_plan);
return -1;
@@ -893,7 +893,7 @@ got_attr_value_player(int p, char *attr, char *value, FILE *fp, char *file)
* num_formula
*/
- if ((parray[p].num_formula = atoi(value)) > MAX_FORMULA) {
+ if ((parray[p].num_formula = atoi(value)) >= MAX_FORMULA) {
warnx("%s: %s: too many formulas (%d)", __func__, file,
parray[p].num_formula);
return -1;
@@ -932,7 +932,7 @@ got_attr_value_player(int p, char *attr, char *value, FILE *fp, char *file)
* num_alias
*/
- if ((parray[p].numAlias = atoi(value)) > MAX_ALIASES) {
+ if ((parray[p].numAlias = atoi(value)) >= MAX_ALIASES) {
warnx("%s: %s: too many aliases (%d)", __func__, file,
parray[p].numAlias);
return -1;
diff --git a/FICS/vers.c b/FICS/vers.c
index d556d4a..c6dd99c 100644
--- a/FICS/vers.c
+++ b/FICS/vers.c
@@ -1,5 +1,5 @@
#include "vers.h"
const char SGS_VERS[] = "";
-const char VERS_NUM[] = "rpblc-1.4.4";
+const char VERS_NUM[] = "rpblc-1.4.5";
const char COMP_DATE[] = __DATE__;
diff --git a/include/colors.h b/include/colors.h
new file mode 100644
index 0000000..6902138
--- /dev/null
+++ b/include/colors.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2019 Markus Uhlin <markus.uhlin@icloud.com>
+ All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE. */
+
+#ifndef _COLORS_H_
+#define _COLORS_H_
+
+/*
+ * Reset all attributes to their defaults
+ */
+#define NORMAL "\x1b[0m"
+
+#define UNDERLINE_ON "\x1b[4m"
+#define UNDERLINE_OFF "\x1b[24m"
+
+#define BLINK_ON "\x1b[5m"
+#define BLINK_OFF "\x1b[25m"
+
+/*
+ * Reverse video
+ */
+#define REVVID_ON "\x1b[7m"
+#define REVVID_OFF "\x1b[27m"
+
+#define BLACK "\x1b[30m"
+#define RED "\x1b[31m"
+#define GREEN "\x1b[32m"
+#define BROWN "\x1b[33m"
+#define BLUE "\x1b[34m"
+#define MAGENTA "\x1b[35m"
+#define CYAN "\x1b[36m"
+#define WHITE "\x1b[37m"
+
+#define BOLDBLACK "\x1b[1;30m"
+#define BOLDRED "\x1b[1;31m"
+#define BOLDGREEN "\x1b[1;32m"
+#define BOLDBROWN "\x1b[1;33m"
+#define BOLDBLUE "\x1b[1;34m"
+#define BOLDMAGENTA "\x1b[1;35m"
+#define BOLDCYAN "\x1b[1;36m"
+#define BOLDWHITE "\x1b[1;37m"
+
+#define UNDERSCORE_ON "\x1b[38m"
+#define UNDERSCORE_OFF "\x1b[39m"
+
+#define BGBLACK "\x1b[40m"
+#define BGRED "\x1b[41m"
+#define BGGREEN "\x1b[42m"
+#define BGBROWN "\x1b[43m"
+#define BGBLUE "\x1b[44m"
+#define BGMAGENTA "\x1b[45m"
+#define BGCYAN "\x1b[46m"
+#define BGWHITE "\x1b[47m"
+#define BGDEFAULT "\x1b[49m"
+
+#if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+static void
+VirtualTerminalProcessing(void)
+{
+ HANDLE output_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ DWORD modes = 0;
+
+ GetConsoleMode(output_handle, &modes);
+ modes |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+ SetConsoleMode(output_handle, modes);
+}
+#endif
+
+#endif