add makedefs options for producing individual files
This may be useful for some build environments to avoid parallel make
issues, and artificially-concocted order dependencies, leaving the ordering
up to that specified in the Makefile.
The related makedefs options are now:
‐s Generate the bogusmon , engrave and epitaph files.
‐1 Generate the epitaph file.
‐2 Generate the engrave file.
‐3 Generate the bogusmon file.
Also resolves an existing issue encountered in doc/makedefs.6 where "and epitaphfiles"
was being produced in the result.
This commit is contained in:
@@ -116,7 +116,26 @@ Generate the
|
||||
,
|
||||
.I engrave
|
||||
and
|
||||
.IR epitaph files.
|
||||
.IR epitaph
|
||||
files.
|
||||
.br
|
||||
.TP
|
||||
.B -1
|
||||
Generate the
|
||||
.IR epitaph
|
||||
file.
|
||||
.br
|
||||
.TP
|
||||
.B -2
|
||||
Generate the
|
||||
.IR engrave
|
||||
file.
|
||||
.br
|
||||
.TP
|
||||
.B -3
|
||||
Generate the
|
||||
.IR bogusmon
|
||||
file.
|
||||
.br
|
||||
.TP
|
||||
.B -h
|
||||
|
||||
@@ -103,14 +103,14 @@ rumors: rumors.tru rumors.fal ../util/makedefs
|
||||
oracles: oracles.txt ../util/makedefs
|
||||
../util/makedefs -h
|
||||
|
||||
engrave: engrave.txt ../util/makedefs
|
||||
../util/makedefs -s
|
||||
engrave: ../util/makedefs
|
||||
../util/makedefs -2
|
||||
|
||||
epitaph: epitaph.txt ../util/makedefs
|
||||
../util/makedefs -s
|
||||
epitaph: ../util/makedefs
|
||||
../util/makedefs -1
|
||||
|
||||
bogusmon: bogusmon.txt ../util/makedefs
|
||||
../util/makedefs -s
|
||||
bogusmon: ../util/makedefs
|
||||
../util/makedefs -3
|
||||
|
||||
options: ../util/makedefs
|
||||
../util/makedefs -v
|
||||
|
||||
@@ -169,7 +169,9 @@ static void do_ext_makedefs(int, char **);
|
||||
static char *padline(char *, unsigned);
|
||||
static unsigned long read_rumors_file(const char *, int *,
|
||||
long *, unsigned long, unsigned);
|
||||
static void do_rnd_access_file(const char *, const char *, unsigned);
|
||||
static void rafile(int);
|
||||
static void do_rnd_access_file(const char *, const char *,
|
||||
const char *, unsigned);
|
||||
static boolean d_filter(char *);
|
||||
static boolean h_filter(char *);
|
||||
static void opt_out_words(char *, int *);
|
||||
@@ -327,24 +329,14 @@ do_makedefs(char *options)
|
||||
break;
|
||||
case 's':
|
||||
case 'S':
|
||||
/*
|
||||
* post-3.6.5:
|
||||
* File must not be empty to avoid divide by 0
|
||||
* in core's rn2(), so provide a default entry.
|
||||
*/
|
||||
do_rnd_access_file(EPITAPHFILE,
|
||||
/* default epitaph: parody of the default engraving */
|
||||
"No matter where I went, here I am.",
|
||||
MD_PAD_RUMORS); /* '_RUMORS' is correct here */
|
||||
do_rnd_access_file(ENGRAVEFILE,
|
||||
/* default engraving: popularized by "The Adventures of
|
||||
Buckaroo Bonzai Across the 8th Dimension" but predates
|
||||
that 1984 movie; some attribute it to Confucius */
|
||||
"No matter where you go, there you are.",
|
||||
MD_PAD_RUMORS); /* '_RUMORS' used here too */
|
||||
do_rnd_access_file(BOGUSMONFILE,
|
||||
/* default bogusmon: iconic monster that isn't in nethack */
|
||||
"grue", MD_PAD_BOGONS);
|
||||
rafile('1');
|
||||
rafile('2');
|
||||
rafile('3');
|
||||
break;
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
rafile(*options);
|
||||
break;
|
||||
#if defined(OLD_MAKEDEFS_OPTIONS)
|
||||
case 'o':
|
||||
@@ -417,6 +409,37 @@ oldfunctionality(char sought)
|
||||
}
|
||||
#endif /* !OLD_MAKEDEFS_OPTIONS */
|
||||
|
||||
static void
|
||||
rafile(int whichone)
|
||||
{
|
||||
switch(whichone) {
|
||||
/*
|
||||
* post-3.6.5:
|
||||
* File must not be empty to avoid divide by 0
|
||||
* in core's rn2(), so provide a default entry.
|
||||
*/
|
||||
case '1':
|
||||
do_rnd_access_file(EPITAPHFILE, "epitaph",
|
||||
/* default epitaph: parody of the default engraving */
|
||||
"No matter where I went, here I am.",
|
||||
MD_PAD_RUMORS); /* '_RUMORS' is correct here */
|
||||
break;
|
||||
case '2':
|
||||
do_rnd_access_file(ENGRAVEFILE, "engrave",
|
||||
/* default engraving: popularized by "The Adventures of
|
||||
Buckaroo Bonzai Across the 8th Dimension" but predates
|
||||
that 1984 movie; some attribute it to Confucius */
|
||||
"No matter where you go, there you are.",
|
||||
MD_PAD_RUMORS); /* '_RUMORS' used here too */
|
||||
break;
|
||||
case '3':
|
||||
do_rnd_access_file(BOGUSMONFILE, "bogusmon",
|
||||
/* default bogusmon: iconic monster that isn't in nethack */
|
||||
"grue", MD_PAD_BOGONS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static char namebuf[1000];
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||
@@ -1057,11 +1080,14 @@ read_rumors_file(
|
||||
static void
|
||||
do_rnd_access_file(
|
||||
const char *fname,
|
||||
const char *basefname,
|
||||
const char *deflt_content,
|
||||
unsigned padlength)
|
||||
{
|
||||
char *line, buf[BUFSZ], xbuf[BUFSZ];
|
||||
char *line, buf[BUFSZ], xbuf[BUFSZ],
|
||||
greptmp[8 + 1 + 3 + 1];
|
||||
|
||||
Sprintf(greptmp, "grep-%.3s.tmp", basefname);
|
||||
Sprintf(filename, DATA_IN_TEMPLATE, fname);
|
||||
Strcat(filename, ".txt");
|
||||
if (!(ifp = fopen(filename, RDTMODE))) {
|
||||
@@ -1089,12 +1115,12 @@ do_rnd_access_file(
|
||||
Strcat(buf, "\n"); /* so make sure that the default one does too */
|
||||
(void) fputs(xcrypt(padline(buf, padlength), xbuf), ofp);
|
||||
|
||||
tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE, FLG_TEMPFILE);
|
||||
tfp = getfp(DATA_TEMPLATE, greptmp, WRTMODE, FLG_TEMPFILE);
|
||||
grep0(ifp, tfp, FLG_TEMPFILE);
|
||||
#ifndef HAS_NO_MKSTEMP
|
||||
ifp = tfp;
|
||||
#else
|
||||
ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE, 0);
|
||||
ifp = getfp(DATA_TEMPLATE, greptmp, RDTMODE, 0);
|
||||
#endif
|
||||
set_fgetline_context(NULL, FALSE, FALSE);
|
||||
|
||||
@@ -1109,7 +1135,7 @@ do_rnd_access_file(
|
||||
Fclose(ofp);
|
||||
|
||||
#ifdef HAS_NO_MKSTEMP
|
||||
delete_file(DATA_TEMPLATE, "grep.tmp");
|
||||
delete_file(DATA_TEMPLATE, greptmp);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -2037,8 +2063,9 @@ text-b/text-c at fseek(0x01234567L + 456L)
|
||||
void
|
||||
do_dungeon(void)
|
||||
{
|
||||
char *line;
|
||||
char *line, greptmp[8 + 1 + 3 + 1];
|
||||
|
||||
Sprintf(greptmp, "grep-%.3s.tmp", "dun");
|
||||
Sprintf(filename, DATA_IN_TEMPLATE, DGN_I_FILE);
|
||||
if (!(ifp = fopen(filename, RDTMODE))) {
|
||||
perror(filename);
|
||||
@@ -2057,12 +2084,12 @@ do_dungeon(void)
|
||||
}
|
||||
Fprintf(ofp, "%s", Dont_Edit_Data);
|
||||
|
||||
tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE, FLG_TEMPFILE);
|
||||
tfp = getfp(DATA_TEMPLATE, greptmp, WRTMODE, FLG_TEMPFILE);
|
||||
grep0(ifp, tfp, FLG_TEMPFILE);
|
||||
#ifndef HAS_NO_MKSTEMP
|
||||
ifp = tfp;
|
||||
#else
|
||||
ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE, 0);
|
||||
ifp = getfp(DATA_TEMPLATE, greptmp, RDTMODE, 0);
|
||||
#endif
|
||||
set_fgetline_context(NULL, FALSE, TRUE);
|
||||
while ((line = fgetline(ifp)) != 0) {
|
||||
@@ -2079,7 +2106,7 @@ do_dungeon(void)
|
||||
Fclose(ofp);
|
||||
|
||||
#ifdef HAS_NO_MKSTEMP
|
||||
delete_file(DATA_TEMPLATE, "grep.tmp");
|
||||
delete_file(DATA_TEMPLATE, greptmp);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user