Move xdmeta() back to commands/xdump.c, internal linkage

Partially revert commit 4c746b5e.
This commit is contained in:
Markus Armbruster 2011-04-09 07:39:58 +02:00
parent 6db74cd282
commit af5e25aa16
3 changed files with 32 additions and 33 deletions

View file

@ -51,7 +51,6 @@ extern void xdhdr(struct xdstr *, char *, int);
extern void xdcolhdr(struct xdstr *, struct castr[]); extern void xdcolhdr(struct xdstr *, struct castr[]);
extern void xdflds(struct xdstr *, struct castr[], void *); extern void xdflds(struct xdstr *, struct castr[], void *);
extern void xdftr(struct xdstr *, int); extern void xdftr(struct xdstr *, int);
extern int xdmeta(struct xdstr *, int);
extern int xundump(FILE *, char *, int *, int); extern int xundump(FILE *, char *, int *, int);
#endif #endif

View file

@ -113,6 +113,38 @@ xdvisible(int type, void *p)
} }
} }
/*
* Dump meta-data for items of type TYPE to XD.
* Return RET_SYN when TYPE doesn't have meta-data, else RET_OK.
*/
static int
xdmeta(struct xdstr *xd, int type)
{
struct castr *ca = ef_cadef(type);
int i;
int n = 0;
if (!ca)
return RET_SYN;
xdhdr(xd, ef_nameof(type), 1);
xdcolhdr(xd, ca);
for (i = 0; ca[i].ca_name; i++) {
if (ca[i].ca_flags & NSC_DEITY && !xd->divine)
continue;
if (ca[i].ca_flags & NSC_EXTRA)
continue;
xdflds(xd, mdchr_ca, &ca[i]);
xd->pr("\n");
n++;
}
xdftr(xd, n);
return RET_OK;
}
/* /*
* Dump items of type TYPE selected by ARG to XD. * Dump items of type TYPE selected by ARG to XD.
* Return RET_OK on success, RET_SYN on error. * Return RET_OK on success, RET_SYN on error.

View file

@ -307,35 +307,3 @@ xdftr(struct xdstr *xd, int n)
else else
xd->pr("/%d\n", n); xd->pr("/%d\n", n);
} }
/*
* Dump meta-data for items of type TYPE to XD.
* Return RET_SYN when TYPE doesn't have meta-data, else RET_OK.
*/
int
xdmeta(struct xdstr *xd, int type)
{
struct castr *ca = ef_cadef(type);
int i;
int n = 0;
if (!ca)
return RET_SYN;
xdhdr(xd, ef_nameof(type), 1);
xdcolhdr(xd, ca);
for (i = 0; ca[i].ca_name; i++) {
if (ca[i].ca_flags & NSC_DEITY && !xd->divine)
continue;
if (ca[i].ca_flags & NSC_EXTRA)
continue;
xdflds(xd, mdchr_ca, &ca[i]);
xd->pr("\n");
n++;
}
xdftr(xd, n);
return RET_OK;
}