From: Ian Jackson Subject: xenstore-ls -f for find(1)-like output Date: Mon, 3 Dec 2007 15:42:25 +0000 Message-ID: <18260.9185.660772.817464@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bYvoLz9WGk" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --bYvoLz9WGk Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit The current output of xenstore-ls can be quite hard to read and it is not very intractable for postprocessing with sort|diff and the like. The patch below provides a -f option which produces output with the full key pathname on each line, and which disables the value truncation and the `.'-padding when used with -p (since these latter two aren't likely to be very useful when values are preceded by long pathnames). While I was at it I added the `-s' option to the usage message, where it was previously missing. The results looks like this: ... /local/domain/1 = "" /local/domain/1/vm = "/vm/8b5fd34a-e268-fab5-9cde-c06eda21df16" /local/domain/1/device = "" /local/domain/1/device/vbd = "" /local/domain/1/device/vbd/2049 = "" /local/domain/1/device/vbd/2049/virtual-device = "2049" /local/domain/1/device/vbd/2049/device-type = "disk" /local/domain/1/device/vbd/2049/protocol = "x86_32-abi" ... Ian. Signed-off-by: Ian Jackson --bYvoLz9WGk Content-Type: text/plain Content-Description: xenstore-ls -f Content-Disposition: inline; filename="tools-xsls-findformat.diff" Content-Transfer-Encoding: 7bit diff -r 6e9ee9b86661 tools/xenstore/xsls.c --- a/tools/xenstore/xsls.c Fri Nov 30 15:03:30 2007 +0000 +++ b/tools/xenstore/xsls.c Mon Dec 03 12:16:31 2007 +0000 @@ -11,6 +11,7 @@ #define STRING_MAX PATH_MAX static int max_width = 80; static int desired_width = 60; +static int show_whole_path = 0; #define TAG " = \"...\"" #define TAG_LEN strlen(TAG) @@ -35,23 +37,31 @@ void print_dir(struct xs_handle *h, char unsigned int nperms; int linewid; - /* Print indent and path basename */ - for (linewid=0; linewid