diff --git a/src/commands/ls.c b/src/commands/ls.c index 1c8384a..d31c143 100644 --- a/src/commands/ls.c +++ b/src/commands/ls.c @@ -166,10 +166,13 @@ static char* get_file_color(struct FileInfo* info) { } static void list_files(struct FileInfo* files, int file_len, struct FileListInfo info, struct Flags* flags, const char* dir_path) { - struct winsize w; ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + if (!isatty(1)) { + flags->one_column = true; + } + char* color; const int column_width = info.max_name + 1; const int row_count = w.ws_col / column_width; @@ -371,7 +374,6 @@ COMMAND(ls) { flags.hide_dot = false; flags.one_column = false; flags.recurse = false; - int start = 0; for (int i = 0; i < argc; i++) { if (!prefix("-", argv[i])) break;