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

Function reveal_paths

src/files.c:3174–3413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3172#define SYSCONFFILE "system configuration file"
3173
3174void
3175reveal_paths(int code)
3176{
3177#if defined(SYSCF)
3178 boolean skip_sysopt = FALSE;
3179#endif
3180 const char *fqn, *nodumpreason;
3181
3182 char buf[BUFSZ];
3183#if defined(SYSCF) || !defined(UNIX) || defined(DLB)
3184 const char *filep;
3185#ifdef SYSCF
3186 const char *gamename = (gh.hname && *gh.hname) ? gh.hname : "NetHack";
3187#endif
3188#endif
3189#if defined(PREFIXES_IN_USE)
3190 const char *cstrp;
3191#endif
3192#ifdef UNIX
3193 char *endp, *envp, cwdbuf[PATH_MAX];
3194#endif
3195#ifdef PREFIXES_IN_USE
3196 int i, maxlen = 0;
3197
3198 raw_print("Variable playground locations:");
3199 for (i = 0; i < PREFIX_COUNT; i++)
3200 raw_printf(" [%-10s]=\"%s\"", fqn_prefix_names[i],
3201 gf.fqn_prefix[i] ? gf.fqn_prefix[i] : "not set");
3202#endif
3203
3204 /* sysconf file */
3205
3206#ifdef SYSCF
3207#ifdef PREFIXES_IN_USE
3208 cstrp = fqn_prefix_names[SYSCONFPREFIX];
3209 maxlen = BUFSZ - sizeof " (in )";
3210 if (cstrp && (int) strlen(cstrp) < maxlen)
3211 Sprintf(buf, " (in %s)", cstrp);
3212#else
3213 buf[0] = '\0';
3214#endif
3215 raw_printf("%s %s%s:", s_suffix(gamename),
3216 SYSCONFFILE, buf);
3217#ifdef SYSCF_FILE
3218 filep = SYSCF_FILE;
3219#else
3220 filep = "sysconf";
3221#endif
3222 fqn = fqname(filep, SYSCONFPREFIX, 0);
3223 if (fqn) {
3224 set_configfile_name(fqn);
3225 filep = get_configfile();
3226 }
3227 raw_printf(" \"%s\"", filep);
3228 if (code == 1) {
3229 raw_printf("NOTE: The %s above is missing or inaccessible!",
3230 SYSCONFFILE);
3231 skip_sysopt = TRUE;

Callers 1

do_deferred_showpathsFunction · 0.85

Calls 15

raw_printFunction · 0.85
s_suffixFunction · 0.85
fqnameFunction · 0.85
set_configfile_nameFunction · 0.85
get_configfileFunction · 0.85
getcwdFunction · 0.85
build_dlb_filenameFunction · 0.85
dump_fmtstrFunction · 0.85
get_portable_deviceFunction · 0.85
copyncharsFunction · 0.85
eosFunction · 0.85
get_default_configfileFunction · 0.85

Tested by

no test coverage detected