(getcols): Return default of 80 columns if both ioctl() and getenv() fail.
(ali_print_name_list): Bugfix. (main): In -user mode, print the argument verbatim if it is not a member of any alias.
Showing
1 changed file
with
7 additions
and
8 deletions
... | @@ -110,6 +110,8 @@ getcols () | ... | @@ -110,6 +110,8 @@ getcols () |
110 | ws.ws_col = strtol (columns, NULL, 10); | 110 | ws.ws_col = strtol (columns, NULL, 10); |
111 | } | 111 | } |
112 | 112 | ||
113 | if (ws.ws_col == 0) | ||
114 | ws.ws_col = 80; | ||
113 | return ws.ws_col; | 115 | return ws.ws_col; |
114 | } | 116 | } |
115 | 117 | ||
... | @@ -137,7 +139,6 @@ ali_print_name_list (list_t list, int off) | ... | @@ -137,7 +139,6 @@ ali_print_name_list (list_t list, int off) |
137 | else | 139 | else |
138 | { | 140 | { |
139 | int ncol = getcols (); | 141 | int ncol = getcols (); |
140 | int nl; | ||
141 | int n = off; | 142 | int n = off; |
142 | 143 | ||
143 | iterator_first (itr); | 144 | iterator_first (itr); |
... | @@ -146,14 +147,11 @@ ali_print_name_list (list_t list, int off) | ... | @@ -146,14 +147,11 @@ ali_print_name_list (list_t list, int off) |
146 | { | 147 | { |
147 | int len; | 148 | int len; |
148 | 149 | ||
149 | nl = 0; | ||
150 | iterator_current (itr, (void **)&item); | 150 | iterator_current (itr, (void **)&item); |
151 | len = strlen (item) + 2; | 151 | len = strlen (item) + 2; |
152 | if (n + len > ncol) | 152 | if (n + len > ncol) |
153 | { | 153 | n = printf ("\n "); |
154 | n = printf ("\n "); | 154 | |
155 | nl = 1; | ||
156 | } | ||
157 | len = printf ("%s", item); | 155 | len = printf ("%s", item); |
158 | iterator_next (itr); | 156 | iterator_next (itr); |
159 | if (!iterator_is_done (itr)) | 157 | if (!iterator_is_done (itr)) |
... | @@ -162,8 +160,7 @@ ali_print_name_list (list_t list, int off) | ... | @@ -162,8 +160,7 @@ ali_print_name_list (list_t list, int off) |
162 | break; | 160 | break; |
163 | n += len; | 161 | n += len; |
164 | } | 162 | } |
165 | if (!nl) | 163 | printf ("\n"); |
166 | printf ("\n"); | ||
167 | } | 164 | } |
168 | iterator_destroy (&itr); | 165 | iterator_destroy (&itr); |
169 | } | 166 | } |
... | @@ -246,6 +243,8 @@ main (int argc, char **argv) | ... | @@ -246,6 +243,8 @@ main (int argc, char **argv) |
246 | ali_print_name_list (nl, 0); | 243 | ali_print_name_list (nl, 0); |
247 | list_destroy (&nl); | 244 | list_destroy (&nl); |
248 | } | 245 | } |
246 | else | ||
247 | printf ("%s\n", argv[i]); | ||
249 | } | 248 | } |
250 | } | 249 | } |
251 | } | 250 | } | ... | ... |
-
Please register or sign in to post a comment