From 4d6110812c48710b9bf3e916eeef376709c908f0 Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Wed, 15 Feb 2023 19:37:37 +0200 Subject: [PATCH] Add "sc" suffix to version number --- src/config.h | 1 + src/subst.c | 2 +- src/unroff.c | 8 ++++++++ src/unroff.h | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config.h b/src/config.h index 8875f20..4d4cacc 100644 --- a/src/config.h +++ b/src/config.h @@ -23,6 +23,7 @@ #define MAJOR_VERSION 1 #define MINOR_VERSION 0 +#define VERSION_SUFFIX "sc" /* Scheme Conservatory */ /* Hack: __GNUC_MINOR__ was introduced together with __attribute__ */ diff --git a/src/subst.c b/src/subst.c index 5563228..ec8a504 100644 --- a/src/subst.c +++ b/src/subst.c @@ -53,7 +53,7 @@ Object p_substitute(int ac, Object *av) { } else if (strcmp(t, "tmpname") == 0) { s = tmpnam(0); } else if (strcmp(t, "version") == 0) { - sprintf(buf, "%d.%d", MAJOR_VERSION, MINOR_VERSION); + sprintf(buf, "%s", get_version_string()); s = buf; } else if (strcmp(t, "weekday") == 0) { fmt = "%a"; diff --git a/src/unroff.c b/src/unroff.c index 50f1d17..fff2170 100644 --- a/src/unroff.c +++ b/src/unroff.c @@ -17,6 +17,14 @@ static int got_filename; static int did_ev_start; static int tflag; +const char *get_version_string(void) { + static char buf[8]; + + snprintf(buf, sizeof(buf), "%d.%d%s", + MAJOR_VERSION, MINOR_VERSION, VERSION_SUFFIX); + return buf; +} + static void usage(void) { fprintf(stderr, "Usage: %s [options] [file...]\n\n", get_progname()); fprintf(stderr, " -mname name of troff macro package (e.g. -ms)\n"); diff --git a/src/unroff.h b/src/unroff.h index 82d0220..b5eb7e1 100644 --- a/src/unroff.h +++ b/src/unroff.h @@ -58,3 +58,5 @@ extern void Load_Source_Port(Object); #include "scmtable.h" #include "stream.h" #include "subst.h" + +const char *get_version_string(void);