#include "xalloc.h"
void
-conv_c(PR *pr, u_char *p)
+conv_c(struct hexdump_pr *pr, u_char *p)
{
char *buf = NULL;
char const *str;
}
void
-conv_u(PR *pr, u_char *p)
+conv_u(struct hexdump_pr *pr, u_char *p)
{
static const char *list[] = {
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
static off_t eaddress; /* end address */
static inline void
-print(PR *pr, unsigned char *bp) {
+print(struct hexdump_pr *pr, unsigned char *bp) {
switch(pr->flags) {
case F_ADDRESS:
}
}
-static void bpad(PR *pr)
+static void bpad(struct hexdump_pr *pr)
{
static const char *spec = " -0+#";
char *p1, *p2;
register struct list_head *fs;
register FS *fss;
register FU *fu;
- register PR *pr;
+ register struct hexdump_pr *pr;
register int cnt;
register unsigned char *bp;
off_t saveaddress;
while (cnt) {
list_for_each(r, &fu->prlist) {
- pr = list_entry(r, PR, prlist);
+ pr = list_entry(r, struct hexdump_pr, prlist);
if (eaddress && address >= eaddress
&& !(pr->flags&(F_TEXT|F_BPAD)))
eaddress = address;
}
list_for_each (p, &endfu->prlist) {
- pr = list_entry(p, PR, prlist);
+ pr = list_entry(p, struct hexdump_pr, prlist);
switch(pr->flags) {
case F_ADDRESS:
printf(pr->fmt, eaddress);
void rewrite_rules(FS *fs)
{
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
- PR *pr;
+ struct hexdump_pr *pr;
FU *fu;
struct list_head *p, *q;
char *p1, *p2, *fmtp;
nconv = 0;
fmtp = fu->fmt;
while (*fmtp) {
- pr = xcalloc(1, sizeof(PR));
+ pr = xcalloc(1, sizeof(struct hexdump_pr));
INIT_LIST_HEAD(&pr->prlist);
list_add_tail(&pr->prlist, &fu->prlist);
}
/*
- * Copy to PR format string, set conversion character
+ * Copy to hexdump_pr format string, set conversion character
* pointer, update original.
*/
savech = *p2;
*/
if (!fu->bcnt)
list_for_each(q, &fu->prlist)
- fu->bcnt += (list_entry(q, PR, prlist))->bcnt;
+ fu->bcnt
+ += (list_entry(q, struct hexdump_pr, prlist))->bcnt;
}
/*
* If the format string interprets any data at all, and it's
fu->reps += (blocksize - fs->bcnt) / fu->bcnt;
if (fu->reps > 1) {
if (!list_empty(&fu->prlist)) {
- pr = list_last_entry(&fu->prlist, PR, prlist);
+ pr = list_last_entry(&fu->prlist,
+ struct hexdump_pr, prlist);
for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
p2 = isspace(*p1) ? p1 : NULL;
if (p2)
struct list_head *p, *pn, *q, *qn, *r, *rn;
FS *fs;
FU *fu;
- PR *pr;
+ struct hexdump_pr *pr;
list_for_each_safe(p, pn, &fshead) {
fs = list_entry(p, FS, fslist);
list_for_each_safe(q, qn, &fs->fulist) {
fu = list_entry(q, FU, fulist);
list_for_each_safe(r, rn, &fu->prlist) {
- pr = list_entry(r, PR, prlist);
+ pr = list_entry(r, struct hexdump_pr, prlist);
free(pr->fmt);
free(pr);
}
#include "c.h"
#include "list.h"
-typedef struct _pr {
+struct hexdump_pr {
struct list_head prlist; /* next print unit */
#define F_ADDRESS 0x001 /* print offset */
#define F_BPAD 0x002 /* blank pad */
char *cchar; /* conversion character */
char *fmt; /* printf format */
char *nospace; /* no whitespace version */
-} PR;
+};
typedef struct _fu {
struct list_head fulist; /* next format unit */
void addfile(char *);
void display(void);
void __attribute__((__noreturn__)) usage(FILE *out);
-void conv_c(PR *, u_char *);
-void conv_u(PR *, u_char *);
+void conv_c(struct hexdump_pr *, u_char *);
+void conv_u(struct hexdump_pr *, u_char *);
int next(char **);
int parse_args(int, char **);