summaryrefslogtreecommitdiff
path: root/Userland/Utilities/ls.cpp
AgeCommit message (Collapse)Author
2023-05-14ls: Migrate away from DeprecatedFileBen Wiederhake
Note that since many low-level bare C APIs are used, null-terminated strings are still necessary in many places, which sadly required the addition of many DeprecatedStrings.
2023-04-22Utilities: Replace ctype.h usage with AK/CharacterTypes.hSam Atkins
2023-04-04Kernel+Userland: Make some of the POSIX types largerAndreas Kling
Expand the following types from 32-bit to 64-bit: - blkcnt_t - blksize_t - dev_t - nlink_t - suseconds_t - clock_t This matches their size on other 64-bit systems.
2023-03-21Everywhere: Use `LibFileSystem` where trivialCameron Youell
2023-03-05LibCore+Everywhere: Return an Error from DirIterator::error()Sam Atkins
This also removes DirIterator::error_string(), since the same strerror() string will be included when you print the Error itself. Except in `ls` which is still using fprintf() for now.
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
2023-01-15ls: Add an option to print the human readable sizes in powers of 10Arda Cinar
2023-01-01Utilities: Print arbitrary bytes in `ls`Victor Song
Currently, `ls` crashes when printing certain byte sequences. This is likely due to an out-of-bounds error when iterating through the `StringView` representing the file name to be printed. We switch to using an index-based for loop to a range-based for loop. This fixes #16678.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-04-03ls: Use `Core::System::pledge(..)` instead of LibC APIBrian Gianforcaro
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-26ls: Remove leading dashes from ArgsParser argument nameAli Mohammad Pur
Otherwise the full argument would be "----ignore-backups", which is most certainly not correct :^)
2022-03-24Userland+Tests: Convert File::read_link() from String to ErrorOr<String>Kenneth Myhra
This converts the return value of File::read_link() from String to ErrorOr<String>. The rest of the change is to support the potential of an Error being returned and subsequent release of the value when no Error is returned. Unfortunately at this stage none of the places affected can utililize our TRY() macro.
2022-02-19ls: Add option -1 which lists one file per lineAnton Kling
2022-01-28Revert "ls: Display times in the user's local time zone"Timothy Flynn
This reverts commit 0c13a3a8ff07a7dde8acc30ede885685c224ef64.
2022-01-28ls: Display times in the user's local time zoneTimothy Flynn
ls is already using local time, but needs tzset() for that to actually work.
2022-01-09Everywhere: Add `serenity_dev_{makedev,major,minor}`Michel Hermier
Add them in `<Kernel/API/Device.h>` and use these to provides `{makedev,major,minor}` in `<sys/sysmacros.h>`. It aims to be more in line with other Unix implementations and avoid code duplication in user land.
2022-01-04ls: Fix duplicated error message when opening a directory failsMarco Cutecchia
2021-12-04ls: Port to LibMain :^)Andreas Kling
2021-11-26Userland: Use Core::ArgsParser's Vector<StringView> API everywhereAndreas Kling
...and remove the Vector<String> variant since there are no remaining users of this API.
2021-09-18AK: Make Utf8View constructors inline and remove C string constructorAndreas Kling
Using StringView instead of C strings is basically always preferable. The only reason to use a C string is because you are calling a C API.
2021-08-18Utilities: Remove memset calls inside lsJean-Baptiste Boric
2021-08-18Utilities: Properly sort files in lsJean-Baptiste Boric
2021-08-12Kernel+LibC: Use 64 bit values for ino_tLiav A
Since the InodeIndex encapsulates a 64 bit value, it is correct to ensure that the Kernel is exposing the entire value and the LibC is aware of it. This commit requires an entire re-compile because it's essentially a change in the Kernel ABI, together with a corresponding change in LibC.
2021-07-12ls: Add option to list subdirectories recursivelyAriel Don
List subdirectories encountered using -R or --recursive flags with ls.
2021-06-01LibGUI+Shell+bt+ls: Use proper APIs for creating file URLsMax Wipfli
This patch replaces ad-hoc generation of file URL strings with using URL::create_with_file_scheme().
2021-05-25ls: Fix incorrect -t sort orderAndreas Kling
Dr. POSIX says -t should sort the output by mtime ascending.
2021-05-17Utilities: Correct non-standard assert macros includesJean-Baptiste Boric
2021-05-14LibC: Move makedev(), major(), minor(), to sys/types.hJean-Baptiste Boric
It's technically not specified by POSIX, but it appears most Unix-like systems worth mentioning put those definitions there. Also, it's more logical since the dev_t type is defined there.
2021-05-03Userland: Fix 64-bit portability issuesGunnar Beutner
2021-04-26Utilities: Make ls respect options when specifying more than one pathGunnar Beutner
When specifying more than one path (e.g. with ls -l /usr /bin) ls would ignore other display options and fall back to showing the files in short mode.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18ls: Remove extra spaces after filenames when pipingJagger De Leo
Fixes #5671
2021-04-17ls: list files in cwd before listing directories when listing pathssetepenre
2021-04-11ls: ls will print directory name when listing multiple directoriessetepenre
2021-03-17ls: Make 64 bit cleanJean-Baptiste Boric
2021-03-17Userland: Fix printf specifiers with off_tJean-Baptiste Boric
In theory we should probably use the 'j' qualifier, but we don't support it.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-29ls: Lazily align the number of hard links in ls output :^)Andreas Kling
Fixes #5155
2021-01-12Userland: Move command-line utilities to Userland/Utilities/Andreas Kling