MCPcopy Create free account
hub / github.com/NetHack/NetHack / getversionstring

Function getversionstring

src/version.c:34–79  ·  view source on GitHub ↗

fill and return the given buffer with the long nethack version string */

Source from the content-addressed store, hash-verified

32
33/* fill and return the given buffer with the long nethack version string */
34char *
35getversionstring(char *buf, size_t bufsz)
36{
37 Strcpy(buf, nomakedefs.version_id);
38
39 {
40 int c = 0;
41#if defined(RUNTIME_PORT_ID)
42 char tmpbuf[BUFSZ], *tmp;
43#endif
44 char *p = eos(buf);
45 boolean dotoff = (p > buf && p[-1] == '.');
46
47 if (dotoff)
48 --p;
49 Strcpy(p, " (");
50#if defined(RUNTIME_PORT_ID)
51 tmp = get_port_id(tmpbuf);
52 if (tmp)
53 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
54 "%s%s", c++ ? "," : "", tmp);
55#endif
56 if (nomakedefs.git_sha)
57 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
58 "%s%s", c++ ? "," : "", nomakedefs.git_sha);
59#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
60 if (nomakedefs.git_branch)
61 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
62 "%sbranch:%s",
63 c++ ? "," : "", nomakedefs.git_branch);
64#endif
65 if (nomakedefs.git_prefix)
66 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
67 "%sprefix:%s",
68 c++ ? "," : "", nomakedefs.git_prefix);
69 if (c)
70 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
71 "%s", ")");
72 else /* if nothing has been added, strip " (" back off */
73 *p = '\0';
74 if (dotoff)
75 Snprintf(eos(buf), (bufsz - strlen(buf)) - 1,
76 "%s", ".");
77 }
78 return buf;
79}
80
81/* version info that could be displayed on status lines;
82 "<game name> <git branch name> <x.y.z version number>";

Callers 10

aboutMsgFunction · 0.85
AboutFunction · 0.85
submit_web_reportFunction · 0.85
dump_everythingFunction · 0.85
doversionFunction · 0.85
doextversionFunction · 0.85
early_version_infoFunction · 0.85
ghack_about_cbFunction · 0.85
AboutFunction · 0.85

Calls 2

eosFunction · 0.85
get_port_idFunction · 0.85

Tested by

no test coverage detected