Date: Thu, 26 May 2005 11:13:26 GMT From: Hirohisa Yamaguchi <umq@ueo.co.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/81495: hexdump(1) format option does not allow literal '%' in output Message-ID: <200505261113.j4QBDPLg067777@www.freebsd.org> Resent-Message-ID: <200505261120.j4QBK1jW081527@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 81495
>Category: bin
>Synopsis: hexdump(1) format option does not allow literal '%' in output
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu May 26 11:20:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Hirohisa Yamaguchi
>Release: 6.0-CURRENT
>Organization:
>Environment:
>Description:
I cannot get literal '%' in hexdump(1) output with any format_string.
Though the man page mentions exceptions in fprintf-style format,
there's no explanation why '%' cannot be printed.
>How-To-Repeat:
exec hexdump(1) with format_string which contains '%%' to get literal '%' in output.
e.g.)
$ echo foo | hexdump -e '"" /1 "%%%02x" "\n"'
I got:
hexdump: %%: bad conversion character
>Fix:
a) If there's any historical reasons to be so, update the man page; to mention that literal '%' cannot be included in output.
or
b) fix it.
I wrote a patch, not thoroughly tested. And flag name is, perhaps, not appropriate.
--- src/usr.bin/hexdump/parse.c.orig Thu Jul 22 22:14:42 2004
+++ src/usr.bin/hexdump/parse.c Thu May 26 19:22:28 2005
@@ -383,6 +383,10 @@ isint2: switch(fu->bcnt) {
badconv(p1);
}
break;
+ case '%':
+ /* skip over '%' */
+ pr->flags = F_ADDRESS;
+ break;
default:
p1[1] = '\0';
badconv(p1);
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505261113.j4QBDPLg067777>
