more makedefs dat/options (trunk only)
More dat/options: include "and" in front of the final entry in
the comma separated lists of options and windowing systems. For the
multi-line options list, fill the paragraph better by splitting lines at
individual words within options rather than at whole option strings.
Also, tweak yesterday's check for DEFAULT_WINDOW_SYS being undefined
so that it actually works as intended.
This commit is contained in:
@@ -1201,7 +1201,7 @@ static const char *build_opts[] = {
|
|||||||
"ANSI default terminal",
|
"ANSI default terminal",
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUTOPICKUP_EXCEPTIONS
|
#ifdef AUTOPICKUP_EXCEPTIONS
|
||||||
"autopickup_exceptions",
|
"autopickup exceptions",
|
||||||
#endif
|
#endif
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
"color",
|
"color",
|
||||||
@@ -1359,10 +1359,10 @@ static const char *build_opts[] = {
|
|||||||
"run-length compression of map in save files",
|
"run-length compression of map in save files",
|
||||||
#endif
|
#endif
|
||||||
#ifdef SYSCF
|
#ifdef SYSCF
|
||||||
"system configuration",
|
"system configuration at run-time",
|
||||||
#endif
|
#endif
|
||||||
save_bones_compat_buf,
|
save_bones_compat_buf,
|
||||||
"basic NetHack features"
|
"and basic NetHack features"
|
||||||
};
|
};
|
||||||
|
|
||||||
struct win_info {
|
struct win_info {
|
||||||
@@ -1404,10 +1404,15 @@ static void
|
|||||||
windowing_sanity()
|
windowing_sanity()
|
||||||
{
|
{
|
||||||
#ifndef DEFAULT_WINDOW_SYS
|
#ifndef DEFAULT_WINDOW_SYS
|
||||||
|
/* pre-standard compilers didn't support #error; wait til run-time */
|
||||||
Fprintf(stderr,
|
Fprintf(stderr,
|
||||||
"Configuration error: DEFAULT_WINDOW_SYS is not defined.\n");
|
"Configuration error: DEFAULT_WINDOW_SYS is not defined.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
|
||||||
|
/* put in a dummy value so that do_options() will compile and makedefs
|
||||||
|
will build, otherwise the message above won't ever get delivered */
|
||||||
|
# define DEFAULT_WINDOW_SYS "<undefined>"
|
||||||
#else /*DEFAULT_WINDOW_SYS*/
|
#else /*DEFAULT_WINDOW_SYS*/
|
||||||
|
|
||||||
if (!window_opts[0].id) {
|
if (!window_opts[0].id) {
|
||||||
@@ -1437,12 +1442,12 @@ windowing_sanity()
|
|||||||
void
|
void
|
||||||
do_options()
|
do_options()
|
||||||
{
|
{
|
||||||
boolean multiple_windowing_systems;
|
static const char indent[] = " ";
|
||||||
int i, length;
|
const char *str, *sep;
|
||||||
const char *str, *indent = " ";
|
char *word, buf[BUFSZ];
|
||||||
|
int i, length, winsyscnt;
|
||||||
|
|
||||||
windowing_sanity();
|
windowing_sanity();
|
||||||
multiple_windowing_systems = (window_opts[1].id != 0);
|
|
||||||
|
|
||||||
filename[0]='\0';
|
filename[0]='\0';
|
||||||
#ifdef FILE_PREFIX
|
#ifdef FILE_PREFIX
|
||||||
@@ -1466,28 +1471,38 @@ do_options()
|
|||||||
Fprintf(ofp,"\nOptions compiled into this edition:\n");
|
Fprintf(ofp,"\nOptions compiled into this edition:\n");
|
||||||
length = COLNO + 1; /* force 1st item onto new line */
|
length = COLNO + 1; /* force 1st item onto new line */
|
||||||
for (i = 0; i < SIZE(build_opts); i++) {
|
for (i = 0; i < SIZE(build_opts); i++) {
|
||||||
str = build_opts[i];
|
str = strcpy(buf, build_opts[i]);
|
||||||
if (length + strlen(str) > COLNO - 5)
|
while (*str) {
|
||||||
Fprintf(ofp,"\n%s", indent), length = strlen(indent);
|
word = index(str, ' ');
|
||||||
else
|
if (word) *word = '\0';
|
||||||
Fprintf(ofp," "), length++;
|
if (length + strlen(str) > COLNO - 5)
|
||||||
Fprintf(ofp,"%s", str), length += strlen(str);
|
Fprintf(ofp,"\n%s", indent), length = strlen(indent);
|
||||||
|
else
|
||||||
|
Fprintf(ofp," "), length++;
|
||||||
|
Fprintf(ofp,"%s", str), length += strlen(str);
|
||||||
|
str += strlen(str) + (word ? 1 : 0);
|
||||||
|
}
|
||||||
Fprintf(ofp,(i < SIZE(build_opts) - 1) ? "," : "."), length++;
|
Fprintf(ofp,(i < SIZE(build_opts) - 1) ? "," : "."), length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winsyscnt = SIZE(window_opts) - 1;
|
||||||
Fprintf(ofp, "\n\nSupported windowing system%s:\n",
|
Fprintf(ofp, "\n\nSupported windowing system%s:\n",
|
||||||
multiple_windowing_systems ? "s" : "");
|
(winsyscnt > 1) ? "s" : "");
|
||||||
length = COLNO + 1; /* force 1st item onto new line */
|
length = COLNO + 1; /* force 1st item onto new line */
|
||||||
for (i = 0; i < SIZE(window_opts) - 1; i++) {
|
for (i = 0; i < winsyscnt; i++) {
|
||||||
str = window_opts[i].name;
|
str = window_opts[i].name;
|
||||||
if (length + strlen(str) > COLNO - 5)
|
if (length + strlen(str) > COLNO - 5)
|
||||||
Fprintf(ofp,"\n%s", indent), length = strlen(indent);
|
Fprintf(ofp,"\n%s", indent), length = strlen(indent);
|
||||||
else
|
else
|
||||||
Fprintf(ofp," "), length++;
|
Fprintf(ofp," "), length++;
|
||||||
Fprintf(ofp,"%s", str), length += strlen(str);
|
Fprintf(ofp,"%s", str), length += strlen(str);
|
||||||
Fprintf(ofp, multiple_windowing_systems ? "," : "."), length++;
|
sep = (winsyscnt == 1) ? "." :
|
||||||
|
(winsyscnt == 2) ? ((i == 0) ? " and" : "") :
|
||||||
|
(i < winsyscnt - 2) ? "," :
|
||||||
|
((i == winsyscnt - 2) ? ", and" : "");
|
||||||
|
Fprintf(ofp, sep), length += strlen(sep);
|
||||||
}
|
}
|
||||||
if (multiple_windowing_systems)
|
if (winsyscnt > 1)
|
||||||
Fprintf(ofp, "\n%swith a default of %s.",
|
Fprintf(ofp, "\n%swith a default of %s.",
|
||||||
indent, DEFAULT_WINDOW_SYS);
|
indent, DEFAULT_WINDOW_SYS);
|
||||||
Fprintf(ofp,"\n\n");
|
Fprintf(ofp,"\n\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user