Add new parameters to makedefs: --debug and --make
"makedefs --debug --make q" is equivalent to "makedefs -q" with DEBUG defined.
This commit is contained in:
@@ -118,6 +118,14 @@ and
|
|||||||
.IR vis_tab.h .
|
.IR vis_tab.h .
|
||||||
.SH LONG COMMANDS
|
.SH LONG COMMANDS
|
||||||
.TP
|
.TP
|
||||||
|
.BI --debug
|
||||||
|
Show debugging output.
|
||||||
|
.br
|
||||||
|
.TP
|
||||||
|
.B --make \fR[\fIcommand\fR]
|
||||||
|
Execute a short command. Command is given without preceding dash.
|
||||||
|
.br
|
||||||
|
.TP
|
||||||
.BI --input " file"
|
.BI --input " file"
|
||||||
Specify the input
|
Specify the input
|
||||||
.I file
|
.I file
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#define MAKEDEFS_C /* use to conditionally include file sections */
|
#define MAKEDEFS_C /* use to conditionally include file sections */
|
||||||
/* #define DEBUG */ /* uncomment for debugging info */
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "permonst.h"
|
#include "permonst.h"
|
||||||
@@ -385,6 +384,7 @@ getfp(template, tag, mode)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean debug = FALSE;
|
||||||
|
|
||||||
static FILE *inputfp;
|
static FILE *inputfp;
|
||||||
static FILE *outputfp;
|
static FILE *outputfp;
|
||||||
@@ -431,6 +431,15 @@ do_ext_makedefs(int argc, char **argv){
|
|||||||
Fprintf(stdout, "%s", version_string(buf, delim));
|
Fprintf(stdout, "%s", version_string(buf, delim));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
IS_OPTION("debug"){
|
||||||
|
debug = TRUE;
|
||||||
|
CONTINUE;
|
||||||
|
}
|
||||||
|
IS_OPTION("make"){
|
||||||
|
CONSUME;
|
||||||
|
do_makedefs(argv[0]);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
IS_OPTION("input"){
|
IS_OPTION("input"){
|
||||||
CONSUME;
|
CONSUME;
|
||||||
if(!strcmp(argv[0], "-")){
|
if(!strcmp(argv[0], "-")){
|
||||||
@@ -2246,36 +2255,30 @@ put_qt_hdrs()
|
|||||||
/*
|
/*
|
||||||
* The main header record.
|
* The main header record.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
if (debug) Fprintf(stderr, "%ld: header info.\n", ftell(ofp));
|
||||||
Fprintf(stderr, "%ld: header info.\n", ftell(ofp));
|
|
||||||
#endif
|
|
||||||
(void) fwrite((genericptr_t)&(qt_hdr.n_hdr), sizeof(int), 1, ofp);
|
(void) fwrite((genericptr_t)&(qt_hdr.n_hdr), sizeof(int), 1, ofp);
|
||||||
(void) fwrite((genericptr_t)&(qt_hdr.id[0][0]), sizeof(char)*LEN_HDR,
|
(void) fwrite((genericptr_t)&(qt_hdr.id[0][0]), sizeof(char)*LEN_HDR,
|
||||||
qt_hdr.n_hdr, ofp);
|
qt_hdr.n_hdr, ofp);
|
||||||
(void) fwrite((genericptr_t)&(qt_hdr.offset[0]), sizeof(long),
|
(void) fwrite((genericptr_t)&(qt_hdr.offset[0]), sizeof(long),
|
||||||
qt_hdr.n_hdr, ofp);
|
qt_hdr.n_hdr, ofp);
|
||||||
#ifdef DEBUG
|
if (debug) {
|
||||||
for(i = 0; i < qt_hdr.n_hdr; i++)
|
for(i = 0; i < qt_hdr.n_hdr; i++)
|
||||||
Fprintf(stderr, "%s @ %ld, ", qt_hdr.id[i], qt_hdr.offset[i]);
|
Fprintf(stderr, "%s @ %ld, ", qt_hdr.id[i], qt_hdr.offset[i]);
|
||||||
|
Fprintf(stderr, "\n");
|
||||||
Fprintf(stderr, "\n");
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The individual class headers.
|
* The individual class headers.
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < qt_hdr.n_hdr; i++) {
|
for(i = 0; i < qt_hdr.n_hdr; i++) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
if (debug) Fprintf(stderr, "%ld: %s header info.\n", ftell(ofp),
|
||||||
Fprintf(stderr, "%ld: %s header info.\n", ftell(ofp),
|
qt_hdr.id[i]);
|
||||||
qt_hdr.id[i]);
|
|
||||||
#endif
|
|
||||||
(void) fwrite((genericptr_t)&(msg_hdr[i].n_msg), sizeof(int),
|
(void) fwrite((genericptr_t)&(msg_hdr[i].n_msg), sizeof(int),
|
||||||
1, ofp);
|
1, ofp);
|
||||||
(void) fwrite((genericptr_t)&(msg_hdr[i].qt_msg[0]),
|
(void) fwrite((genericptr_t)&(msg_hdr[i].qt_msg[0]),
|
||||||
sizeof(struct qtmsg), msg_hdr[i].n_msg, ofp);
|
sizeof(struct qtmsg), msg_hdr[i].n_msg, ofp);
|
||||||
#ifdef DEBUG
|
if (debug) { int j;
|
||||||
{ int j;
|
|
||||||
for(j = 0; j < msg_hdr[i].n_msg; j++) {
|
for(j = 0; j < msg_hdr[i].n_msg; j++) {
|
||||||
Fprintf(stderr, "msg %d @ %ld (%ld)",
|
Fprintf(stderr, "msg %d @ %ld (%ld)",
|
||||||
msg_hdr[i].qt_msg[j].msgnum,
|
msg_hdr[i].qt_msg[j].msgnum,
|
||||||
@@ -2287,7 +2290,6 @@ put_qt_hdrs()
|
|||||||
Fprintf(stderr, "\n");
|
Fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2340,9 +2342,7 @@ do_questtxt()
|
|||||||
/* we have summary text; replace raw %E record with it */
|
/* we have summary text; replace raw %E record with it */
|
||||||
Strcpy(in_line, summary_p); /* (guaranteed to fit) */
|
Strcpy(in_line, summary_p); /* (guaranteed to fit) */
|
||||||
} else if(qt_comment(in_line)) continue;
|
} else if(qt_comment(in_line)) continue;
|
||||||
#ifdef DEBUG
|
if (debug) Fprintf(stderr, "%ld: %s", ftell(stdout), in_line);
|
||||||
Fprintf(stderr, "%ld: %s", ftell(stdout), in_line);
|
|
||||||
#endif
|
|
||||||
(void) fputs(xcrypt(in_line), ofp);
|
(void) fputs(xcrypt(in_line), ofp);
|
||||||
}
|
}
|
||||||
Fclose(ifp);
|
Fclose(ifp);
|
||||||
|
|||||||
Reference in New Issue
Block a user