pretty.c: add %x00 format specifier.
This adds a %xXX format which inserts two hexdigits after %x as a byte value in the resulting string. This can be used to add a NUL byte or any other byte that can make machine parsing easier. It is also necessary to use fwrite to print out the data since printf will terminate if you feed it a NUL. Signed-off-by: Govind Salinas <blix@sophiasuchtig.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bc6100087c
commit
42c8c74c14
@ -317,8 +317,10 @@ void show_log(struct rev_info *opt, const char *sep)
|
||||
if (opt->show_log_size)
|
||||
printf("log size %i\n", (int)msgbuf.len);
|
||||
|
||||
if (msgbuf.len)
|
||||
printf("%s%s%s", msgbuf.buf, extra, sep);
|
||||
if (msgbuf.len) {
|
||||
fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
|
||||
printf("%s%s", extra, sep);
|
||||
}
|
||||
strbuf_release(&msgbuf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user