| 5220 | non-malloc'ing version of file_name_concat. */ |
| 5221 | |
| 5222 | static void |
| 5223 | attach (char *dest, char const *dirname, char const *name) |
| 5224 | { |
| 5225 | char const *dirnamep = dirname; |
| 5226 | |
| 5227 | /* Copy dirname if it is not ".". */ |
| 5228 | if (dirname[0] != '.' || dirname[1] != 0) |
| 5229 | { |
| 5230 | while (*dirnamep) |
| 5231 | *dest++ = *dirnamep++; |
| 5232 | /* Add '/' if 'dirname' doesn't already end with it. */ |
| 5233 | if (dirnamep > dirname && dirnamep[-1] != '/') |
| 5234 | *dest++ = '/'; |
| 5235 | } |
| 5236 | while (*name) |
| 5237 | *dest++ = *name++; |
| 5238 | *dest = 0; |
| 5239 | } |
| 5240 | |
| 5241 | /* Allocate enough column info suitable for the current number of |
| 5242 | files and display columns, and initialize the info to represent the |