changeset 319:dc763f806dc4

Left truncate file names in list output. Thanks to Tormod Volden (lists.tormod@gmail.com) for providing this patch to truncate long file names on the left instead of the right when producing the listing output.
author William Astle <lost@l-w.ca>
date Tue, 04 Feb 2014 20:16:35 -0700
parents bcd1daabdb2e
children a640ff4ed95f
files lwasm/list.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/list.c	Fri Jan 10 18:59:26 2014 -0700
+++ b/lwasm/list.c	Tue Feb 04 20:16:35 2014 -0700
@@ -65,6 +65,9 @@
 	
 	for (cl = as -> line_head; cl; cl = nl)
 	{
+		char *linespec;
+		int linespec_len;
+
 		nl = cl -> next;
 		if (CURPRAGMA(cl, PRAGMA_NOLIST))
 		{
@@ -193,7 +196,13 @@
 		}
 		/* the 32.32 below is deliberately chosen so that the start of the line text is at
 		   a multiple of 8 from the start of the list line */
-		fprintf(of, "(%32.32s):%05d ", cl -> linespec, cl -> lineno);
+		linespec = cl -> linespec;
+		linespec_len = strlen(linespec);
+		if (linespec_len > 32)
+		{
+			linespec += linespec_len - 32;
+		}
+		fprintf(of, "(%32.32s):%05d ", linespec, cl -> lineno);
 		i = 0;
 		for (tc = cl -> ltext; *tc; tc++)
 		{