Mercurial > octave
comparison scripts/miscellaneous/what.m @ 21634:96518f623c91
Backed out changeset dcf8922b724b
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 20 Apr 2016 11:06:03 -0700 |
parents | dcf8922b724b |
children | f382293bc11d |
comparison
equal
deleted
inserted
replaced
21633:dcf8922b724b | 21634:96518f623c91 |
---|---|
135 endfunction | 135 endfunction |
136 | 136 |
137 function __display_filenames__ (msg, p, f) | 137 function __display_filenames__ (msg, p, f) |
138 | 138 |
139 if (length (f) > 0) | 139 if (length (f) > 0) |
140 fprintf ("%s %s:\n\n", msg, p); | 140 printf ("%s %s:\n\n", msg, p); |
141 | 141 |
142 maxlen = max (cellfun ("length", f)); | 142 maxlen = max (cellfun ("length", f)); |
143 ncols = max (1, floor (terminal_size ()(2) / (maxlen + 3))); | 143 ncols = max (1, floor (terminal_size ()(2) / (maxlen + 3))); |
144 fmt = sprintf (" %%-%ds", maxlen); | 144 fmt = sprintf (" %%-%ds", maxlen); |
145 fmt = repmat (fmt, [1, ncols]); | 145 fmt = repmat (fmt, [1, ncols]); |
149 for i = 1 : nrows | 149 for i = 1 : nrows |
150 args = f(i:nrows:end); | 150 args = f(i:nrows:end); |
151 if (length (args) < ncols) | 151 if (length (args) < ncols) |
152 args(end+1 : ncols) = {""}; | 152 args(end+1 : ncols) = {""}; |
153 endif | 153 endif |
154 fprintf (fmt, args{:}); | 154 printf (fmt, args{:}); |
155 endfor | 155 endfor |
156 endif | 156 endif |
157 | 157 |
158 endfunction | 158 endfunction |
159 | 159 |