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

Function doextversion

src/version.c:168–277  ·  view source on GitHub ↗

the '#version' command; also a choice for '?' */

Source from the content-addressed store, hash-verified

166
167/* the '#version' command; also a choice for '?' */
168int
169doextversion(void)
170{
171 int rtcontext = 0;
172 const char *rtbuf;
173 dlb *f = (dlb *) 0;
174 char buf[BUFSZ], *p = 0;
175 winid win = create_nhwindow(NHW_TEXT);
176 boolean use_dlb = TRUE,
177 done_rt = FALSE,
178 done_dlb = FALSE,
179 prolog;
180 /* lua_info[] moved to util/mdlib.c and rendered via do_runtime_info() */
181
182#if defined(OPTIONS_AT_RUNTIME)
183 use_dlb = FALSE;
184#else
185 done_rt = TRUE;
186#endif
187
188 /* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
189 the file manually so we can include dynamic version info */
190
191 (void) getversionstring(buf, sizeof buf);
192 /* if extra text (git info) is present, put it on separate line
193 but don't wrap on (x86) */
194 if (strlen(buf) >= COLNO)
195 p = strrchr(buf, '(');
196 if (p && p > buf && p[-1] == ' ' && p[1] != 'x')
197 p[-1] = '\0';
198 else
199 p = 0;
200 putstr(win, 0, buf);
201 if (p) {
202 *--p = ' ';
203 putstr(win, 0, p);
204 }
205
206 if (use_dlb) {
207 f = dlb_fopen(OPTIONS_USED, "r");
208 if (!f) {
209 putstr(win, 0, "");
210 Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED);
211 putstr(win, 0, buf);
212 done_dlb = TRUE;
213 }
214 }
215 /*
216 * already inserted above:
217 * + outdented program name and version plus build date and time
218 * dat/options; display contents with lines prefixed by '-' deleted:
219 * - blank-line
220 * - indented program name and version
221 * blank-line
222 * outdented feature header
223 * - blank-line
224 * indented feature list
225 * spread over multiple lines

Callers 2

doversionFunction · 0.85
hmenu_doextversionFunction · 0.85

Calls 9

getversionstringFunction · 0.85
strrchrFunction · 0.85
dlb_fopenFunction · 0.85
dlb_fgetsFunction · 0.85
do_runtime_infoFunction · 0.85
strip_newlineFunction · 0.85
tabexpandFunction · 0.85
insert_rtoptionFunction · 0.85
dlb_fcloseFunction · 0.85

Tested by

no test coverage detected