From owner-freebsd-bugs Fri Aug 23 8:51:56 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 757AC37B400 for ; Fri, 23 Aug 2002 08:51:46 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF98943E9E for ; Fri, 23 Aug 2002 08:50:13 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7NFo6JU081791 for ; Fri, 23 Aug 2002 08:50:06 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7NFo6wj081790; Fri, 23 Aug 2002 08:50:06 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67FCD37B400 for ; Fri, 23 Aug 2002 08:49:47 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38CA543E75 for ; Fri, 23 Aug 2002 08:47:54 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g7NFjDOT023042 for ; Fri, 23 Aug 2002 08:45:13 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g7NFjDDl023041; Fri, 23 Aug 2002 08:45:13 -0700 (PDT) Message-Id: <200208231545.g7NFjDDl023041@www.freebsd.org> Date: Fri, 23 Aug 2002 08:45:13 -0700 (PDT) From: Elliott Hughes To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/41947: hexdump(1) unprintable ASCII enhancement [PATCH] Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 41947 >Category: misc >Synopsis: hexdump(1) unprintable ASCII enhancement [PATCH] >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 23 08:50:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Elliott Hughes >Release: Mac OS X >Organization: >Environment: Darwin 5.5 powerpc (also Linux 2.4.18 #4 i686) >Description: [Forgive me if this is the wrong place to submit this, but as far as I can work out, the hexdump on Mac OS X and Linux is the one from FreeBSD.] I'm trying to convert myself away from home-grown stuff to using things I can rely on to be around on both Mac OS X at home and Linux at work. The one thing I don't like about BSD hexdump(1) -- available on both -- is that I can't ask it to show me the ASCII part of the hex dump in two colors. This would (a) enable me to distinguish an actual '.' from a pseudo-'.' used to represent an unprintable character and (b) makes it far easier to read control codes out of the ASCII part while still seeing the text. I've used the same command-line options as GNU grep(1), not least because both -c and -C are already taken! I also emulate grep's behavior with regard to not coloring output not going to a tty or going to a tty calling itself "dumb". I've also used HEXDUMP_COLOR analagous to GREP_COLOR. The only thing I'm not sure about is my use of getopt_long. I don't know what the appropriate change to a BSD makefile would be, or whether I actually need to include getopt.h and getopt.c as part of hexdump; does BSD have GNU getopt? [On a not unrelated note, it might be worth a page somewhere explaining how Mac OS X users can join in. We're pseudo-BSD users: enough to benefit from improvements to BSD but not enough to be using an actual BSD release or have the BSD sources/build system around.] >How-To-Repeat: Apply the patch, and try stuff like: hexdump -C --color `which hexdump` # color hexdump hexdump -C --color `which hexdump` | head # no color in a pipe hexdump -C --color=always `which hexdump` | head # unless you force it >Fix: uuencoded diff -u: begin 644 hexdump-patch.txt M9&EF9B`M=2!H97AD=6UP+6]R:6=I;F%L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"0D)"6EF("AI"!<(B`X+S(@7"(E,#1X(%PB(%PB M7%QN7"(B*3L*(`E]"B`**PEI9B`H8V]L;W)?;W!T:6]N*2!["BL)"6-H87(J M('5S97)?;W9EPHM"2AV;VED*69P&1U;7`@6RUB8T-D;W9X72!;+64@9FUT M72!;+68@9FUT7V9I;&5=(%LM;B!L96YG=&A=(BP**PDH=F]I9"EF<')I;G1F M*'-T9&5R&1U;7`@6RUB8T-D;W)V>%T@6RUE(&9M=%T@6RUF(&9M=%]F:6QE72!; M+6X@;&5N9W1H72(L"BLB("`@("`@("`@("`@("`@6RTM8V]L;W(]>V%L=V%Y M%T@(%LM92!F M;71=(%LM9B!F;71?9FEL95T@6RUN(&QE;F=T:%TB+`HK(B`@("`@("!H9"`@ M("`@(%LM8F-D;W)V>%T@(%LM92!F;71=(%LM9B!F;71?9FEL95T@6RUN(&QE M;F=T:%TB+`HK(B`@("`@("`@("`@("`@(%LM+6-O;&]R/7MA;'=A>7,L;F5V M97(L875T;WU=(BP*("(@("`@("`@("`@("`@("!;+7,@Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message