Mercurial > hg > index.cgi
comparison lwasm/list.c @ 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 | 1409debcb1a0 |
children | b6933dc299e6 |
comparison
equal
deleted
inserted
replaced
318:bcd1daabdb2e | 319:dc763f806dc4 |
---|---|
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 for (cl = as -> line_head; cl; cl = nl) | 66 for (cl = as -> line_head; cl; cl = nl) |
67 { | 67 { |
68 char *linespec; | |
69 int linespec_len; | |
70 | |
68 nl = cl -> next; | 71 nl = cl -> next; |
69 if (CURPRAGMA(cl, PRAGMA_NOLIST)) | 72 if (CURPRAGMA(cl, PRAGMA_NOLIST)) |
70 { | 73 { |
71 if (cl -> outputl <= 0) | 74 if (cl -> outputl <= 0) |
72 continue; | 75 continue; |
191 } | 194 } |
192 fprintf(of, " "); | 195 fprintf(of, " "); |
193 } | 196 } |
194 /* the 32.32 below is deliberately chosen so that the start of the line text is at | 197 /* the 32.32 below is deliberately chosen so that the start of the line text is at |
195 a multiple of 8 from the start of the list line */ | 198 a multiple of 8 from the start of the list line */ |
196 fprintf(of, "(%32.32s):%05d ", cl -> linespec, cl -> lineno); | 199 linespec = cl -> linespec; |
200 linespec_len = strlen(linespec); | |
201 if (linespec_len > 32) | |
202 { | |
203 linespec += linespec_len - 32; | |
204 } | |
205 fprintf(of, "(%32.32s):%05d ", linespec, cl -> lineno); | |
197 i = 0; | 206 i = 0; |
198 for (tc = cl -> ltext; *tc; tc++) | 207 for (tc = cl -> ltext; *tc; tc++) |
199 { | 208 { |
200 if ((*tc) == '\t') | 209 if ((*tc) == '\t') |
201 { | 210 { |