Merge branch 'NetHack-3.6'
This commit is contained in:
35
src/files.c
35
src/files.c
@@ -2441,10 +2441,14 @@ char *origbuf;
|
||||
int len;
|
||||
boolean retval = TRUE;
|
||||
|
||||
while (*origbuf == ' ' || *origbuf == '\t') /* skip leading whitespace */
|
||||
++origbuf; /* (caller probably already did this) */
|
||||
(void) strncpy(buf, origbuf, sizeof buf - 1);
|
||||
buf[sizeof buf - 1] = '\0'; /* strncpy not guaranteed to NUL terminate */
|
||||
/* convert any tab to space, condense consecutive spaces into one,
|
||||
remove leading and trailing spaces (exception: if there is nothing
|
||||
but spaces, one of them will be kept even though it leads/trails) */
|
||||
mungspaces(strcpy(buf, origbuf));
|
||||
mungspaces(buf);
|
||||
|
||||
/* find the '=' or ':' */
|
||||
bufp = find_optparam(buf);
|
||||
@@ -3170,7 +3174,11 @@ boolean
|
||||
proc_wizkit_line(buf)
|
||||
char *buf;
|
||||
{
|
||||
struct obj *otmp = readobjnam(buf, (struct obj *) 0);
|
||||
struct obj *otmp;
|
||||
|
||||
if (strlen(buf) >= BUFSZ)
|
||||
buf[BUFSZ - 1] = '\0';
|
||||
otmp = readobjnam(buf, (struct obj *) 0);
|
||||
|
||||
if (otmp) {
|
||||
if (otmp != &cg.zeroobj)
|
||||
@@ -3278,22 +3286,23 @@ boolean FDECL((*proc), (char *));
|
||||
|
||||
/* merge now read line with previous ones, if necessary */
|
||||
if (!ignoreline) {
|
||||
len = (int) strlen(inbuf) + 1;
|
||||
len = (int) strlen(ep) + 1; /* +1: final '\0' */
|
||||
if (buf)
|
||||
len += (int) strlen(buf);
|
||||
len += (int) strlen(buf) + 1; /* +1: space */
|
||||
tmpbuf = (char *) alloc(len);
|
||||
*tmpbuf = '\0';
|
||||
if (buf) {
|
||||
Sprintf(tmpbuf, "%s %s", buf, inbuf);
|
||||
Strcat(strcpy(tmpbuf, buf), " ");
|
||||
free(buf);
|
||||
} else
|
||||
Strcpy(tmpbuf, inbuf);
|
||||
buf = tmpbuf;
|
||||
}
|
||||
buf = strcat(tmpbuf, ep);
|
||||
buf[sizeof inbuf - 1] = '\0';
|
||||
}
|
||||
|
||||
if (morelines || (ignoreline && !oldline))
|
||||
continue;
|
||||
|
||||
if (handle_config_section(ep)) {
|
||||
if (handle_config_section(buf)) {
|
||||
free(buf);
|
||||
buf = (char *) 0;
|
||||
continue;
|
||||
@@ -3315,11 +3324,11 @@ boolean FDECL((*proc), (char *));
|
||||
}
|
||||
bufp++;
|
||||
if (g.config_section_chosen)
|
||||
free(g.config_section_chosen);
|
||||
free(g.config_section_chosen), g.config_section_chosen = 0;
|
||||
section = choose_random_part(bufp, ',');
|
||||
if (section)
|
||||
if (section) {
|
||||
g.config_section_chosen = dupstr(section);
|
||||
else {
|
||||
} else {
|
||||
config_error_add("No config section to choose");
|
||||
rv = FALSE;
|
||||
}
|
||||
@@ -3431,6 +3440,8 @@ int which_set;
|
||||
struct symparse *symp;
|
||||
char *bufp, *commentp, *altp;
|
||||
|
||||
if (strlen(buf) >= BUFSZ)
|
||||
buf[BUFSZ - 1] = '\0';
|
||||
/* convert each instance of whitespace (tabs, consecutive spaces)
|
||||
into a single space; leading and trailing spaces are stripped */
|
||||
mungspaces(buf);
|
||||
|
||||
@@ -1155,7 +1155,7 @@ boolean fullsubs; /* True -> full substitution for file name, False ->
|
||||
else
|
||||
Strcpy(tmpbuf, "{current date+time}");
|
||||
break;
|
||||
case 'v': /* version, eg. "3.6.3-0" */
|
||||
case 'v': /* version, eg. "3.6.4-0" */
|
||||
Sprintf(tmpbuf, "%s", version_string(verbuf));
|
||||
break;
|
||||
case 'u': /* UID */
|
||||
|
||||
Reference in New Issue
Block a user