aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-06 19:28:25 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-06 19:28:46 +0200
commit5eb7837aa8706b0050dee2fd6a2eb5d41510d18d (patch)
tree5b2fc579f10336465a4c91f0c12b1186379ca6fe
parent7575e07b9f10fc115b62022a9cc96098f072afac (diff)
downloadmblaze-5eb7837aa8706b0050dee2fd6a2eb5d41510d18d.tar.gz
mshow: simplify -H with orig_header
-rw-r--r--mshow.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/mshow.c b/mshow.c
index e73d457..c7bb43d 100644
--- a/mshow.c
+++ b/mshow.c
@@ -601,7 +601,7 @@ show(char *file)
}
newcur = strdup(file);
- if (qflag)
+ if (qflag && !Hflag)
msg = blaze822(file);
else
msg = blaze822_file(file);
@@ -611,17 +611,8 @@ show(char *file)
}
if (Hflag) { // raw headers
- size_t hl = blaze822_headerlen(msg);
- char *header = malloc(hl);
- if (!header)
- return;
- int fd = open(file, O_RDONLY);
- if (fd == -1) {
- free(header);
- return;
- }
- hl = read(fd, header, hl);
- fwrite(header, 1, hl, stdout);
+ fwrite(blaze822_orig_header(msg), 1, blaze822_headerlen(msg),
+ stdout);
printf("\n");
} else if (Lflag) { // all headers
char *h = 0;