(xdump): New options dump.
(xdopt): New. (xdhdr1): New, factored out of xdhdr().
This commit is contained in:
parent
8db5a84a8f
commit
549347defa
1 changed files with 37 additions and 2 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "news.h"
|
#include "news.h"
|
||||||
#include "nsc.h"
|
#include "nsc.h"
|
||||||
|
#include "optlist.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump everything under the sun
|
* Dump everything under the sun
|
||||||
|
@ -366,12 +367,18 @@ xdfldnam(struct castr ca[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dump first line of header for dump NAME. */
|
||||||
|
static void
|
||||||
|
xdhdr1(char *name)
|
||||||
|
{
|
||||||
|
pr("XDUMP %s %ld\n", name, (long)time(NULL));
|
||||||
|
}
|
||||||
|
|
||||||
/* Dump header for dump NAME with fields described by CA[]. */
|
/* Dump header for dump NAME with fields described by CA[]. */
|
||||||
static void
|
static void
|
||||||
xdhdr(char *name, struct castr ca[])
|
xdhdr(char *name, struct castr ca[])
|
||||||
{
|
{
|
||||||
pr("XDUMP %s %ld\n", name, (long)time(NULL));
|
xdhdr1(name);
|
||||||
|
|
||||||
xdfldnam(ca);
|
xdfldnam(ca);
|
||||||
pr("\n");
|
pr("\n");
|
||||||
}
|
}
|
||||||
|
@ -456,6 +463,32 @@ xdchr(int chridx)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dump Options[], return RET_OK. */
|
||||||
|
static int
|
||||||
|
xdopt(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *sep;
|
||||||
|
|
||||||
|
xdhdr1("options");
|
||||||
|
|
||||||
|
sep = "";
|
||||||
|
for (i = 0; Options[i].opt_key; ++i) {
|
||||||
|
pr("%s%s", sep, Options[i].opt_key);
|
||||||
|
sep = " ";
|
||||||
|
}
|
||||||
|
pr("\n");
|
||||||
|
|
||||||
|
sep = "";
|
||||||
|
for (i = 0; Options[i].opt_key; ++i) {
|
||||||
|
pr("%s%d", sep, *Options[i].opt_valuep);
|
||||||
|
sep = " ";
|
||||||
|
}
|
||||||
|
pr("\n");
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* Experimental extended dump command */
|
/* Experimental extended dump command */
|
||||||
int
|
int
|
||||||
xdump(void)
|
xdump(void)
|
||||||
|
@ -473,6 +506,8 @@ xdump(void)
|
||||||
return xditem(type, player->argp[2]);
|
return xditem(type, player->argp[2]);
|
||||||
} else if (!strncmp(p, "chr", strlen(p)) && player->argp[2]) {
|
} else if (!strncmp(p, "chr", strlen(p)) && player->argp[2]) {
|
||||||
return xdchr(chridx_by_name(player->argp[2]));
|
return xdchr(chridx_by_name(player->argp[2]));
|
||||||
|
} else if (!strncmp(p, "opt", strlen(p))) {
|
||||||
|
return xdopt();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue