void
reveal_paths(VOID_ARGS)
{
- const char *fqn, *filep;
- const char *fqn, *gamename = (hname && *hname) ? hname : "NetHack";
++ const char *fqn, *gamename = (g.hname && *g.hname) ? g.hname : "NetHack";
char buf[BUFSZ];
- #if defined(UNIX)
- char *strp;
+ #if defined(SYSCF) || !defined(UNIX)
+ const char *filep;
#endif
+#if defined(PREFIXES_IN_USE)
+ const char *cstrp;
+#endif
#ifdef UNIX
- char *envp, cwdbuf[PATH_MAX];
+ char *endp, *envp, cwdbuf[PATH_MAX];
#endif
#ifdef PREFIXES_IN_USE
- const char *strp;
int i, maxlen = 0;
raw_print("Variable playground locations:");
#ifdef SYSCF
#ifdef PREFIXES_IN_USE
- strp = fqn_prefix_names[SYSCONFPREFIX];
+ cstrp = fqn_prefix_names[SYSCONFPREFIX];
maxlen = BUFSZ - sizeof " (in )";
- if (cstrp && strlen(cstrp) < (size_t) maxlen)
- if (strp && (int) strlen(strp) < maxlen)
- Sprintf(buf, " (in %s)", strp);
++ if (cstrp && (int) strlen(cstrp) < maxlen)
+ Sprintf(buf, " (in %s)", cstrp);
#else
buf[0] = '\0';
#endif
#ifndef UNIX
#ifdef PREFIXES_IN_USE
#ifdef WIN32
- strp = fqn_prefix_names[SYSCONFPREFIX];
+ cstrp = fqn_prefix_names[SYSCONFPREFIX];
#else
- strp = fqn_prefix_names[HACKPREFIX];
+ cstrp = fqn_prefix_names[HACKPREFIX];
#endif /* WIN32 */
maxlen = BUFSZ - sizeof " (in )";
- if (cstrp && strlen(cstrp) < (size_t) maxlen)
- if (strp && (int) strlen(strp) < maxlen)
- Sprintf(buf, " (in %s)", strp);
++ if (cstrp && (int) strlen(cstrp) < maxlen)
+ Sprintf(buf, " (in %s)", cstrp);
#endif /* PREFIXES_IN_USE */
- raw_printf("Your game's loadable symbols file%s:", buf);
+ raw_printf("%s loadable symbols file%s:", s_suffix(gamename), buf);
#endif /* UNIX */
#ifdef UNIX
buf[0] = '\0';
#ifdef PREFIXES_IN_USE
- strp = fqn_prefix_names[CONFIGPREFIX];
+ cstrp = fqn_prefix_names[CONFIGPREFIX];
maxlen = BUFSZ - sizeof " (in )";
- if (cstrp && strlen(cstrp) < (size_t) maxlen)
- if (strp && (int) strlen(strp) < maxlen)
- Sprintf(buf, " (in %s)", strp);
++ if (cstrp && (int) strlen(cstrp) < maxlen)
+ Sprintf(buf, " (in %s)", cstrp);
#endif /* PREFIXES_IN_USE */
raw_printf("Your personal configuration file%s:", buf);
around for potionbreathe() [and we can't set obj->in_use
to 'amt' because that's not implemented] */
obj->in_use = 1;
- pline("BOOM! They explode!");
+ pline("%sThey explode!", !Deaf ? "BOOM! " : "");
wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1));
exercise(A_STR, FALSE);
- if (!breathless(youmonst.data) || haseyes(youmonst.data))
+ if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data))
potionbreathe(obj);
useupall(obj);
losehp(amt + rnd(9), /* not physical damage */
singlepotion->dknown = FALSE;
} else {
singlepotion->dknown = !Hallucination;
+ *newbuf = '\0';
if (mixture == POT_WATER && singlepotion->dknown)
Sprintf(newbuf, "clears");
- else
+ else if (!Blind)
Sprintf(newbuf, "turns %s",
hcolor(OBJ_DESCR(objects[mixture])));
- pline_The("%spotion%s %s.", oldbuf,
- more_than_one ? " that you dipped into" : "", newbuf);
- if (!objects[old_otyp].oc_uname
- && !objects[old_otyp].oc_name_known && old_dknown) {
+ if (*newbuf)
+ pline_The("%spotion%s %s.", oldbuf,
+ more_than_one ? " that you dipped into" : "",
+ newbuf);
+ else
+ pline("Somehing happens.");
+
+ if (old_dknown
+ && !objects[old_otyp].oc_name_known
+ && !objects[old_otyp].oc_uname) {
struct obj fakeobj;
- fakeobj = zeroobj;
+
+ fakeobj = cg.zeroobj;
fakeobj.dknown = 1;
fakeobj.otyp = old_otyp;
fakeobj.oclass = POTION_CLASS;
putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
}
-STATIC_VAR struct window_procs dumplog_windowprocs_backup;
-STATIC_VAR FILE *dumplog_file;
+static struct window_procs dumplog_windowprocs_backup;
+static FILE *dumplog_file;
#ifdef DUMPLOG
-STATIC_VAR time_t dumplog_now;
+static time_t dumplog_now;
- static char *FDECL(dump_fmtstr, (const char *, char *));
-
- static char *
- dump_fmtstr(fmt, buf)
+ char *
+ dump_fmtstr(fmt, buf, fullsubs)
const char *fmt;
char *buf;
+ boolean fullsubs; /* True -> full substitution for file name, False ->
+ * partial substitution for '--showpaths' feedback
+ * where there's no game in progress when executed */
{
const char *fp = fmt;
char *bp = buf;
Sprintf(tmpbuf, "%ld", uid);
break;
case 'n': /* player name */
- Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown");
+ if (fullsubs)
- Sprintf(tmpbuf, "%s", *plname ? plname : "unknown");
++ Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown");
+ else
+ Strcpy(tmpbuf, "{hero name}");
break;
case 'N': /* first character of player name */
- Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u');
+ if (fullsubs)
- Sprintf(tmpbuf, "%c", *plname ? *plname : 'u');
++ Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u');
+ else
+ Strcpy(tmpbuf, "{hero initial}");
break;
}
+ if (fullsubs) {
+ /* replace potentially troublesome characters (including
+ <space> even though it might be an acceptable file name
+ character); user shouldn't be able to get ' ' or '/'
+ or '\\' into plname[] but play things safe */
+ (void) strNsubst(tmpbuf, " ", "_", 0);
+ (void) strNsubst(tmpbuf, "/", "_", 0);
+ (void) strNsubst(tmpbuf, "\\", "_", 0);
+ /* note: replacements are only done on field substitutions,
+ not on the template (from sysconf or DUMPLOG_FILE) */
+ }
- slen = strlen(tmpbuf);
- if (len + slen < BUFSZ-1) {
+ slen = (int) strlen(tmpbuf);
+ if (len + slen < BUFSZ - 1) {
len += slen;
Sprintf(bp, "%s", tmpbuf);
bp += slen;